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

@@ -1,4 +1,5 @@
import asyncio
import inspect
import itertools
import random
import time
@@ -424,7 +425,10 @@ class UpdateMethods:
if not builder.resolved:
await builder.resolve(self)
if not builder.filter(event):
filter = builder.filter(event)
if inspect.isawaitable(filter):
filter = await filter
if not filter:
continue
try: