Skip to content

Commit 309b9ad

Browse files
committed
feat: DispatcherInterface.exec_result
1 parent 12a2c71 commit 309b9ad

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/graia/broadcast/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async def Executor(
188188
if i:
189189
await run_always_await(i, dii, None, None)
190190

191-
result = await run_always_await(target_callable, **parameter_compile_result)
191+
dii.exec_result.set_result(await run_always_await(target_callable, **parameter_compile_result))
192192
except (ExecutionStop, PropagationCancelled):
193193
raise
194194
except RequirementCrashed as e:
@@ -233,6 +233,7 @@ async def Executor(
233233

234234
dii.ctx.reset(dii_token)
235235

236+
result = dii.exec_result.result()
236237
if result.__class__ is Force:
237238
return result.target
238239
elif result is RemoveMe:

src/graia/broadcast/interfaces/dispatcher.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Union,
1212
)
1313

14+
from asyncio import Future
1415
from ..entities.event import Dispatchable
1516
from ..entities.signatures import Force
1617
from ..exceptions import ExecutionStop, RequirementCrashed
@@ -47,6 +48,7 @@ class DispatcherInterface(Generic[T_Event]):
4748
}
4849

4950
ctx: "ClassVar[Ctx[DispatcherInterface]]" = Ctx("bcc_dii")
51+
exec_result: Future[Any]
5052

5153
broadcast: "Broadcast"
5254
dispatchers: List[T_Dispatcher]
@@ -66,6 +68,7 @@ def __init__(self, broadcast_instance: "Broadcast", dispatchers: List[T_Dispatch
6668
self.current_path = NestableIterable([])
6769
self.current_oplog = []
6870
self.success = set()
71+
self.exec_result = Future()
6972
self._depth = depth
7073

7174
@property

0 commit comments

Comments
 (0)