diff --git a/pyproject.toml b/pyproject.toml index f26f59c..e573bb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "emp_hooks" -version = "0.0.11" +version = "0.0.12" description = "emp hooks" authors = [ {name = "johnny-emp",email = "johnny@empyrealsdk.com"} diff --git a/src/emp_hooks/handlers/twitter/__init__.py b/src/emp_hooks/handlers/twitter/__init__.py index 9519d9c..b777bef 100644 --- a/src/emp_hooks/handlers/twitter/__init__.py +++ b/src/emp_hooks/handlers/twitter/__init__.py @@ -1,3 +1,4 @@ +import asyncio import functools import json import os @@ -55,10 +56,13 @@ def tweet_handler(func: Callable[[Tweet], bool]): """ @functools.wraps(func) - def execute_tweet(data): + async def execute_tweet(data): tweet_json = json.loads(data["data"]) tweet = Tweet(tweet_json) - result = func(tweet) + if asyncio.iscoroutinefunction(func): + result = await func(tweet) + else: + result = func(tweet) sys.stdout.flush() return result