此代码:
usr = await app.resolve_peer(uid)
udata = InputUser(user_id=usr.user_id, access_hash=usr.access_hash)
r = await app.invoke(functions.messages.DeleteChatUser(chat_id=chan, user_id=udata))
print(r)
退货:AttributeError: 'InputPeerChannel' object has no attribute 'to_bytes'
文档中:
class pyrogram.raw.functions.messages.DeleteChatUser**
Deletes a user from a chat and sends a service message on it.
Parameters:
chat_id (int 64-bit) – Chat ID.
user_id (InputUser) – User ID to be deleted.
revoke_history (bool, optional) – Remove the entire chat history of the specified user in this chat.
出什么问题了?也许我的udata类型不对?
1条答案
按热度按时间kcugc4gi1#
我不确定,但“DeleteChatUser”似乎只适用于组,而不是频道。
对于团体,可能是工作代码:
但我需要一个通道解决方案,所以我使用了: