Telebot - 检查机器人是否是频道的管理员
Telebot - Check if the bot is admin on a channel
我需要检查机器人是否是某个频道的管理员。我正在使用库 pyTelegramBotAPI。
我试过这个:
bot.get_chat_member(msg.forward_from_chat.id, '@TestBot')
但它给了我这个错误:
[b'{"ok":false,"error_code":400,"description":"Bad Request: wrong user_id specified"}']"
好的,我明白了为什么它不起作用。 user_id 参数用于 int
,因此输入机器人的用户名无效。要修复,只需使用@getidsbot 之类的东西获取机器人的 ID,并将 ID 作为参数 user_id
放入 method get_chat_member()
我需要检查机器人是否是某个频道的管理员。我正在使用库 pyTelegramBotAPI。
我试过这个:
bot.get_chat_member(msg.forward_from_chat.id, '@TestBot')
但它给了我这个错误:
[b'{"ok":false,"error_code":400,"description":"Bad Request: wrong user_id specified"}']"
好的,我明白了为什么它不起作用。 user_id 参数用于 int
,因此输入机器人的用户名无效。要修复,只需使用@getidsbot 之类的东西获取机器人的 ID,并将 ID 作为参数 user_id
放入 method get_chat_member()