Use host, port, and debug from default configurations

This commit is contained in:
Richard Chien 2018-08-17 23:45:43 +08:00
parent c81db1659c
commit 3e09f7457f

View File

@ -40,7 +40,12 @@ class NoneBot(CQHttp):
async def _(ctx):
asyncio.ensure_future(handle_notice_or_request(self, ctx))
def run(self, host=None, port=None, *args, **kwargs):
def run(self, host: str = None, port: int = None, *args, **kwargs):
host = host or self.config.HOST
port = port or self.config.PORT
if 'debug' not in kwargs:
kwargs['debug'] = self.config.DEBUG
logger.info(f'Running on {host}:{port}')
super().run(host=host, port=port, loop=asyncio.get_event_loop(),
*args, **kwargs)