mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-22 22:37:37 +08:00
🐛 移除liteyuki.channel.on_receive() wrapper对async和sync function的判断冗余代码
This commit is contained in:
parent
39a9c39924
commit
0fb5b84392
@ -157,16 +157,10 @@ class Channel:
|
|||||||
"""
|
"""
|
||||||
if receiver is None:
|
if receiver is None:
|
||||||
for func in self._on_receive_funcs:
|
for func in self._on_receive_funcs:
|
||||||
if is_coroutine_callable(func):
|
run_coroutine(func(data))
|
||||||
run_coroutine(func(data))
|
|
||||||
else:
|
|
||||||
func(data)
|
|
||||||
else:
|
else:
|
||||||
for func in self._on_receive_funcs_with_receiver.get(receiver, []):
|
for func in self._on_receive_funcs_with_receiver.get(receiver, []):
|
||||||
if is_coroutine_callable(func):
|
run_coroutine(func(data))
|
||||||
run_coroutine(func(data))
|
|
||||||
else:
|
|
||||||
func(data)
|
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
Loading…
Reference in New Issue
Block a user