I was looking for some way in order to listen and catch new message provide by telegram gropus.
I have not found libraries or API in order to do this in python.
Someone have any suggestion?
Thank you,
RV
Follow the link to your bot by clicking the link that looks like t.me/{yourBotUsername}. This is where you will receive messages. Go ahead and send a message to your bot. To prevent spam, bots cannot initiate a chat, so we need to send it a message to enable the bot to message us back.
c) On the desktop app's homescreen, click on the three horizontal lines on the top left corner to open the app menu. Once the menu pops up, select "Settings". d) On the screen that shows the 'Settings' options, scroll down to the 'Privacy and Security' option, then select 'Export Telegram Data'.
Using Telethon
Replace channel_name
with your telegram channel.
from telethon import TelegramClient, events, sync
# Remember to use your own values from my.telegram.org!
api_id = ...
api_hash = '...'
client = TelegramClient('anon', api_id, api_hash)
@client.on(events.NewMessage(chats='channel_name'))
async def my_event_handler(event):
print(event.raw_text)
client.start()
client.run_until_disconnected()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With