Add lots of comments and logs

This commit is contained in:
Richard Chien
2018-07-21 00:46:34 +08:00
parent 1c78eb1b80
commit 21db23168f
8 changed files with 94 additions and 34 deletions

View File

@ -76,9 +76,19 @@ async def handle_notice_or_request(bot: NoneBot, ctx: Dict[str, Any]) -> None:
event += f'.{ctx["sub_type"]}'
if post_type == 'notice':
_log_notice(ctx)
session = NoticeSession(bot, ctx)
else: # must be 'request'
_log_request(ctx)
session = RequestSession(bot, ctx)
logger.debug(f'Emitting event: {event}')
await _bus.emit(event, session)
def _log_notice(ctx: Dict[str, Any]) -> None:
logger.info(f'Notice: {ctx}')
def _log_request(ctx: Dict[str, Any]) -> None:
logger.info(f'Request: {ctx}')