aboutsummaryrefslogtreecommitdiffstats
path: root/slack/task.py
diff options
context:
space:
mode:
Diffstat (limited to 'slack/task.py')
-rw-r--r--slack/task.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/slack/task.py b/slack/task.py
index 2caf264..27abd48 100644
--- a/slack/task.py
+++ b/slack/task.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import Any, Awaitable, Coroutine, Generator, Tuple, TypeVar
+from typing import Any, Awaitable, Coroutine, Generator, List, Tuple, TypeVar
from uuid import uuid4
import weechat
@@ -75,6 +75,11 @@ def create_task(
return task
+async def await_all_concurrent(requests: List[Coroutine[Any, Any, T]]) -> List[T]:
+ tasks = [create_task(request) for request in requests]
+ return [await task for task in tasks]
+
+
async def sleep(milliseconds: int):
future = FutureTimer()
weechat.hook_timer(