Create NoneBot class inheriting CQHttp

This commit is contained in:
Richard Chien
2018-07-04 09:28:31 +08:00
parent 2a2a7a2ae3
commit 030a31e63f
8 changed files with 44 additions and 36 deletions

View File

@ -1,8 +1,9 @@
from typing import Dict, Any, Optional, Callable, Union
from aiocqhttp import CQHttp, Error as CQHttpError
from aiocqhttp import Error as CQHttpError
from aiocqhttp.bus import EventBus
from . import NoneBot
from .log import logger
from .session import BaseSession
@ -34,14 +35,14 @@ on_request = _make_event_deco('request')
class NoticeSession(BaseSession):
__slots__ = ()
def __init__(self, bot: CQHttp, ctx: Dict[str, Any]):
def __init__(self, bot: NoneBot, ctx: Dict[str, Any]):
super().__init__(bot, ctx)
class RequestSession(BaseSession):
__slots__ = ()
def __init__(self, bot: CQHttp, ctx: Dict[str, Any]):
def __init__(self, bot: NoneBot, ctx: Dict[str, Any]):
super().__init__(bot, ctx)
async def approve(self, remark: str = ''):
@ -67,7 +68,7 @@ class RequestSession(BaseSession):
pass
async def handle_notice_or_request(bot: CQHttp, ctx: Dict[str, Any]) -> None:
async def handle_notice_or_request(bot: NoneBot, ctx: Dict[str, Any]) -> None:
post_type = ctx['post_type'] # "notice" or "request"
detail_type = ctx[f'{post_type}_type']
event = f'{post_type}.{detail_type}'