console.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Red_Star 作者: medeor413 项目源码 文件源码
def _listen(self):
        conf = self.config_manager.config
        while self.run_loop:
            try:
                t_input = await self._readline()
            except CancelledError:
                raise
            except Exception:
                self.logger.exception("Exception waiting for input: ", exc_info=True)
                continue
            args = shlex.split(t_input)
            if not args:
                continue
            elif args[0].lower() in self.con_commands:
                try:
                    await self.con_commands[args[0].lower()](args[1:])
                except ConsoleCommandSyntaxError as e:
                    err = str(e) if str(e) else "No additional information."
                    print("Syntax error: " + err)
                except CancelledError:
                    raise
                except Exception:
                    self.logger.exception("Exception while running console command: ", exc_info=True)
            else:
                print("Invalid command.")

    # Console command functions
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号