1

I'm programming a Telegram bot. I want to search for a specific message in a telegram channel and get its message id. Is it possible? Thx in advance.

4

1 回答 1

3

据我所知,您无法仅使用 Telegram 的机器人 API 来搜索消息(在特定聊天中)。您需要一个 MTProto 客户端来执行此操作。您可以使用 pyrogram 或 telethon 与 MTProto 交互,然后使用 messages.search。

但是有一个问题。如果您正在搜索的消息在频道中,您可以https://t.me/s/CHANNELUSERNAME使用 BeautifulSoup 之类的库进行网络抓取。

于 2020-04-15T13:40:47.660 回答