You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do we have a similar way to listen for incoming messages same as Telethon Python has
@client.on(events.NewMessage(incoming=True))asyncdefhandle_new_message(event):
ifevent.is_private: # only auto-reply to private chatsfrom_=awaitevent.client.get_entity(event.from_id) # this lookup will be cached by telethonifnotfrom_.bot: # don't auto-reply to botsprint(time.asctime(), '-', event.message) # optionally log time and messagetime.sleep(1) # pause for 1 second to rate-limit automatic repliesawaitevent.respond(message)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Do we have a similar way to listen for incoming messages same as Telethon Python has
Beta Was this translation helpful? Give feedback.
All reactions