使用机器人"ValueError: Could not find the input entity for PeerChannel"



我怎么也想不明白这是怎么回事。我已经创建了一个新的Telegram Bot,并创建了一个新的频道,其中我将我的Bot添加为Admin。

在阅读了100次文档后,我试图让实体"看到"。how but:

  • get_dialogues()对于bot是不允许的
  • client.get_entity(")是不允许的

不知道还能做什么…

我确实在通道中发布了一些消息。

我的代码看起来像这样:

from telethon import TelegramClient
telethon_client = TelegramClient(
api_id=int(config['TELETHON_API_ID']),
api_hash=config['TELETHON_API_HASH'],
session=config['TELETHON_SESSION']
).start(bot_token=config['TELEGRAM_BOT_TOKEN'])
with telethon_client:
telethon_client.loop.run_until_complete(__async_get_users(chat_id))
async def __async_get_users(chat_id):
channel = await telethon_client.get_entity(chat_id) # -100xxxxx
tg_users = await telethon_client.get_participants(channel)

任何帮助,领导,或想法感谢!

好的,所以,不确定是什么导致了这个问题的解决,但我做到了:

  • 按照@Lonami的建议禁用@BotFather组隐私模式
  • 发送组内其他消息
  • 删除并重新添加bot到组

我仍然有这个问题,但在清除会话后,它现在工作正常!

感谢@Lonami的帮助!

相关内容

最新更新