-
Notifications
You must be signed in to change notification settings - Fork 178
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
example for event "NewMessage" #74
Comments
hey, you can use them like so async function eventPrint(event) {
const message = event.message;
// Checks if it's a private message (from user or bot)
if (event.isPrivate){
// prints sender id
console.log(message.senderId);
// read message
if (message.text == "hello"){
const sender = await message.getSender();
console.log("sender is",sender);
await client.sendMessage(sender,{
message:`hi your id is ${message.senderId}`
});
}
}
}
client.addEventHandler(eventPrint, new events.NewMessage({})); |
It's worked. anyway it was hard to handle the update. so i will use telegram bot api get update instead and use some functions that cannot do with bot Thank you so much for fast respond. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, I cannot find any example to handle event update "NewMessage"
As I googled found this https://painor.gitbook.io/gramjs/getting-started/updates-events
this worked fine.
this one not working.
do you have any example working code for this ?
Thank you.
The text was updated successfully, but these errors were encountered: