mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 08:15:42 +00:00
Added support async command
This commit is contained in:
parent
7e0c50a04e
commit
6dd3de63a9
@ -7,6 +7,7 @@
|
||||
# Licence: FPA
|
||||
# (c) kuitoi.su 2023
|
||||
import builtins
|
||||
import inspect
|
||||
import logging
|
||||
from typing import AnyStr
|
||||
|
||||
@ -242,7 +243,11 @@ class Console:
|
||||
self.log(text)
|
||||
command_object = self.__func.get(cmd)
|
||||
if command_object:
|
||||
out = command_object['f'](cmd_s[1:])
|
||||
func = command_object['f']
|
||||
if inspect.iscoroutinefunction(func):
|
||||
out = await func(cmd_s[1:])
|
||||
else:
|
||||
out = func(cmd_s[1:])
|
||||
if out:
|
||||
self.log(out)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user