Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrape Telegram channel for changes

Can anyone point me to a way to programatically check for changes in a Telegram room? I can't decipher the API. I want to do something like:

telegram.onMessageReceived('room_id', (msg) => {
  console.log(msg.content);
}

I usually use Python, but open to using NodeJS because I want to have it always running, monitoring for changes on an Ubuntu server.

As far as I can find on the internet, everything is pointing to the bot API, but as I understand it, it would only be notified of updates to messages to the bot. I want to monitor public rooms in which I cannot add the bot as an administrator since I did not create the room. Or is there some way to add a bot to public rooms? I don't think so.

Also the room I want to monitor doesn't allow anyone to chat. It's just to notify subscribers.

I've read these SOs so far and am still confused:

Can a Telegram bot read messages of channel

How do I join my bot to the Channel?

How to join my Telegram Bot to PUBLIC channel

like image 391
Aymon Fournier Avatar asked Nov 08 '22 20:11

Aymon Fournier


1 Answers

in node.js telegram library you can check the last message.date and compare with last date you have stored. if changed there is new message

like image 55
ghane nikraftar Avatar answered Nov 14 '22 22:11

ghane nikraftar