gpt4 book ai didi

python - 如何使用 telethon 获取关于 Telegram 机器人或描述的信息

转载 作者:太空宇宙 更新时间:2023-11-03 23:57:19 25 4
gpt4 key购买 nike

当我收到与机器人的历史聊天消息时,我在返回的 message_context 中看不到“你好”消息(“这个机器人能做什么?”)。我怎样才能得到它?

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

最佳答案

您需要使用 GetFullUserRequest获取 bot_info UserFull 的属性实例:

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)

关于python - 如何使用 telethon 获取关于 Telegram 机器人或描述的信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57095193/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com