我正在使用 Telethon 编写电报客户端。如何获取频道说明?get_entity
方法不提供通道描述。
问问题
3161 次
3 回答
3
from telethon.tl.functions.channels import GetFullChannelRequest
# creating client here
ch = client.get_entity("@mychannel")
ch_full = client(GetFullChannelRequest(channel=ch))
ch_full.full_chat.about # this is what you need
因此,您可能需要检查full_chat
属性,因为它包含其余信息
于 2018-03-28T11:36:17.410 回答
1
您必须将getChat方法与chat_id
or一起使用@username
,.result.description
这就是您所需要的。
于 2018-01-25T00:07:12.023 回答
0
另一个使用机器人的例子
from telethon.sync import TelegramClient, events
from telethon import functions
bot = TelegramClient(
'bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN)
@bot.on(events.NewMessage)
async def my_event_handler(event):
chat = await event.get_chat()
result = await bot(functions.messages.GetFullChatRequest(
chat_id=chat.id
))
print(result.full_chat.about)
bot.run_until_disconnected()
于 2019-12-23T10:10:26.120 回答