Skip to content

Commit

Permalink
simple execute fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kesha1225 committed Apr 12, 2020
1 parent 3a11591 commit 6d18102
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vkwave/bots/easy/easy_bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import typing
import inspect

from vkwave.api.methods import API
from vkwave.api.token.token import BotSyncPoolTokens, BotSyncSingleToken, Token
Expand Down Expand Up @@ -118,7 +119,9 @@ def __init__(self, func: typing.Callable[[BaseEvent], typing.Awaitable[typing.An

async def execute(self, event: BotEvent) -> typing.Any:
new_event = SimpleBotEvent(event)
return await self.func(new_event)
if inspect.iscoroutinefunction(self.func):
return await self.func(new_event)
return self.func(new_event)

def message_handler(self, *filters: BaseFilter):
def decorator(func: typing.Callable[..., typing.Any]):
Expand Down

0 comments on commit 6d18102

Please sign in to comment.