-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
Hey, I'm having a bit of trouble using @run_async
, here is my code snippet (I'm using the same architecture as in the updater_bot and installed the repository version):
dp.addTelegramCommandHandler("akkarin", akkarin)
and:
@run_async
def akkarin(bot, update, args):
pass
However when I send a command /akkarin, I get the following error in the console:
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Program Files\Python 3.5\lib\threading.py", line 923, in _bootstrap_inner
self.run()
File "C:\Program Files\Python 3.5\lib\threading.py", line 871, in run
self._target(*self._args, **self._kwargs)
File "C:\Program Files\Python 3.5\lib\site-packages\telegram\dispatcher.py", line 39, in pooled
result = func(*args, **kwargs)
TypeError: akkarin() missing 1 required positional argument: 'args'
I've tried fidling a bit with dispatcher.py to solve my problem, but to no avail due to my lack of knowledge; apparently, @run_async
doesn't work with functions with an args argument. Is it a planned feature or is there a reason why it won't be implemented ?
Thank you for what you are doing, I had my own bot but this module just makes things that much easier, it takes less place and is easier to maintain :)
EDIT: I should note that this function works perfectly without the @run_async decoractor, it is just that it, you know, doesn't run asynchronously