T
T
Ternick2021-07-31 14:15:44
Python
Ternick, 2021-07-31 14:15:44

Decorator not working for getting telethon messages?

Hello !

from telethon.sync import TelegramClient, events
from time import sleep


api_id = 0000000
api_hash = "0000"#Таки да, тут были токены
client = TelegramClient(str(api_id), api_id, api_hash)
client.start()

@client.on(events.NewMessage)
def normal_handler(event):
  print(event)

def main():
  sleep(60)

if __name__ == '__main__':
  main()


The bottom line is that I'm writing from another account, the result is nothing. What's wrong?
By the way, this is a real telegram account, not a bot.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WolfInChains, 2021-07-31
@Ternick

So you yourself sent the script to the slip. Well, you launch the client ahead of time
sleep(60)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question