Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to listen to new messages on a specific channel? #663

Open
devcarlosalberto opened this issue Apr 15, 2024 · 1 comment
Open

How to listen to new messages on a specific channel? #663

devcarlosalberto opened this issue Apr 15, 2024 · 1 comment

Comments

@devcarlosalberto
Copy link

I looked through all the documentation and didn't find anything like that, I was confused. I just wanted to observe whenever a new message arrived on a Telegram channel so that I could activate automations based on the messages that arrived.

@AminAbbar
Copy link

AminAbbar commented Apr 16, 2024

do somthing like this :

import { NewMessage } from 'telegram/events'
const callbackFunction= async (event:any) => {
    eventHandler(event); //example function
} 
Client.addEventHandler(callbackFunction, new NewMessage({ incoming: true, channels: ['@something' , '@somthing2']  }) )

//if you want to remove the event for some reason 
Client.removeEventHandler(callbackFunction)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants