Allow event's func to be async (#1461)

Fixes #1344.
This commit is contained in:
JuniorJPDJ
2020-05-16 09:58:37 +02:00
committed by GitHub
parent c45f2e7c39
commit 634bc3a8bd
5 changed files with 33 additions and 15 deletions

View File

@@ -118,8 +118,10 @@ class CallbackQuery(EventBuilder):
elif event.query.data != self.match:
return
if not self.func or self.func(event):
return event
if self.func:
# Return the result of func directly as it may need to be awaited
return self.func(event)
return True
class Event(EventCommon, SenderGetter):
"""