簡體   English   中英

如何使用Telethon獲取有關Telegram機器人或其描述的信息

[英]How to get a Telegram bot about or description using telethon

當我通過漫游器收到歷史記錄聊天消息時,在返回message_context中看不到“ hello”消息(“此漫游器可以做什么?”)。 我怎么才能得到它?

message_context = client.send_message(bot_name, '/start')
for message in client.iter_messages(bot_name):
   print("{}".format(bot_name))

您需要使用GetFullUserRequest來獲取UserFull實例的bot_info屬性:

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.users.GetFullUserRequest(bot_name))
    bot_info = result.bot_info
    print(bot_info)
    print(bot_info.description)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM