答案 0 :(得分:2)
您可以使用电报API函数messages.checkChatInvite
from telethon import TelegramClient
from telethon.tl.functions.messages.check_chat_invite import CheckChatInviteRequest
client = TelegramClient('session_id', '+phonenumber', api_id=1234, api_hash='0cxxxxxxx')
client.connect()
channel_hash = "AAAAAxxxxxxxx"
result = client.invoke(CheckChatInviteRequest(channel_hash))
print (result)
结果将是这样的:
(chatInviteAlready (ID: 0x5abcdefg) = (chat=(channel (ID: 0x5abcdefg) = (creator=None, kicked=None, left=None, editor=True, moderator=None, broadcast=True, verified=None, megagroup=None, restricted=None, democracy=None, signatures=None, min=None, id=123456789, access_hash=615xxxxxxxxx, title=testChannel, username=None, photo=(chatPhotoEmpty (ID: 0x37xxxxxxx) = ()), date=2017-06-14 14:34:50, version=0, restriction_reason=None))))
此处响应中的ID是您要查找的频道ID。 上面的示例使用的是Telethon和python,但您可以使用任何语言和客户端连接到电报API。