【发布时间】:2022-01-15 13:10:16
【问题描述】:
我正在尝试将机器人添加到频道,但每次尝试我都会收到以下错误消息:
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot
我的代码基本上是来自documentation 和这个doc 的复制粘贴
和代码
from telethon.sync import TelegramClient, events, functions, types
from telethon.tl.types import PeerChat, PeerChannel
bot = TelegramClient('bot', api_id, api_hash).start(bot_token=token)
with bot:
print(bot.get_me())
# I have this link https://telegram.me/joinchat/<HASH>
result = bot(functions.messages.ImportChatInviteRequest(hash="<HASH>"))
print(result)
我使用@botfather,我的配置是:
- AllowGroups:启用
- GroupPrivacy:启用
我已阅读机器人无法加入频道或群组,除非您是管理员才能将机器人添加为管理员。如果是真的,为什么要在文档上发帖,你可以通过邀请链接来做到这一点?我无法加入群组或频道...
【问题讨论】:
标签: python telegram-bot telethon