mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Handle return from callback
This commit is contained in:
parent
565750e784
commit
1f595db700
@ -134,7 +134,7 @@ class Console:
|
||||
print_formatted_text(s)
|
||||
|
||||
def log(self, s: AnyStr) -> None:
|
||||
self.__logger.log(f"\n{s}")
|
||||
self.__logger.info(f"{s}")
|
||||
# self.write(s)
|
||||
|
||||
def __lshift__(self, s: AnyStr) -> None:
|
||||
@ -199,17 +199,20 @@ class Console:
|
||||
cmd_s = cmd_in.split(" ")
|
||||
cmd = cmd_s[0]
|
||||
if cmd == "":
|
||||
pass
|
||||
continue
|
||||
else:
|
||||
command_object = self.__func.get(cmd)
|
||||
if command_object:
|
||||
self.log(str(command_object['f'](cmd_s[1:])))
|
||||
out = command_object['f'](cmd_s[1:])
|
||||
if out:
|
||||
self.log(out)
|
||||
else:
|
||||
self.log(self.__not_found % cmd)
|
||||
except KeyboardInterrupt:
|
||||
raise KeyboardInterrupt
|
||||
except Exception as e:
|
||||
print(f"Error in console.py: {e}")
|
||||
self.__logger.exception(e)
|
||||
|
||||
async def start(self):
|
||||
self.__is_run = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user