我目前正在使用telegramcli,现在,我必须检查用户是否在一个特定的组中,只有这几行代码
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.CheckChatInviteRequest(hash=hash))
我用print(type(result))
得到一个结果:
<class 'telethon.tl.types.ChatInvite'>
如果我不在组内,这是
<class 'telethon.tl.types.ChatInviteAlready'>
如果我已经在里面的话。你知道吗
现在,我想做的是:
if type(result) == telethon.tl.types.ChatInvite:
print('You are not inside the group')
但很明显这不起作用,它给了我这个错误NameError: name 'telethon' is not defined
如何检查子类?你知道吗
谢谢:)
如果可以导入
ChatInvite
,请执行以下操作:相关问题 更多 >
编程相关推荐