Telethon: Cannot invoke requests from within update handlers
Hello, i used Telethon 0.11.5 and everything worked, but when i installed new Telethon 0.13 version some part of my code stopped working.
@staticmethod
def update_handler(self, update_object):
if isinstance(update_object, UpdateShortMessage):
MyBot.join_channels(update_object)
self.add_update_handler(self.update_handler)
while True: # listening for updates
pass
these fucntions were in class made like in offical example. (MyBot is my class)
def join_channels(self, channels):
print("something")
self(ResolveUsernameRequest(channel))
print("i have done all work")
normally at Telethon 0.11.5 join_channels functions used to print ‘something’ then invoke request and print “i have done…” BUT in Telethon 0.13 it ony prints “something” and after it dont do and print anything. How can i fix it? I have tested and without recieving updates script works fine, maybe there is problem with threads?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (12 by maintainers)
Workaround for
v0.13
:Just install
v0.12.2
, it’s the latest version which doesn’t use this new thread thing. Never ask for a deadline.How can i install Telethon 0.11.5 back? And how i can send file at 0.11.5 version?
Okay I see the problem. Invoking a request from within the update handler will make it not work. Why? Because it will wait for the
ReadThread
to receive it, but it’s theReadThread
who reads it and the one who’s waiting, so it hangs.