How can I get messages from a Telegram channel with the Telegram API

自古美人都是妖i 提交于 2019-12-06 22:11:56

问题


How can I access to a Telegram channel messages with a bot registered as channel admin?

I am trying to get all the messages from Telegram channel and display them in an ASP.NET webpage (c#)

I am able to get updates when new message sent directly to the bot:

var json = wc.DownloadString(" https://api.telegram.org/bot<token>/getUpdates");

but its not working for the channel.


回答1:


unfortunately it's not possible yet.(they may come up with something in future) as admin you can just send messages to channel.




回答2:


The only way until now is as follows:

  1. Your bot be added to the channel by its administrator.
  2. You set the bot's privacy to disabled.

Step 1 helps your bot to join the channel so it see the messages.

Step 2 makes your bot listening to all messages of the channel.



来源:https://stackoverflow.com/questions/34526029/how-can-i-get-messages-from-a-telegram-channel-with-the-telegram-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!