🚨 remove linter error

This commit is contained in:
yanyongyu 2021-06-16 00:58:47 +08:00
parent 8849cb73bb
commit 6749afe75e
4 changed files with 9 additions and 6 deletions

View File

@ -9,6 +9,7 @@ Quart 驱动适配
""" """
import asyncio import asyncio
from dataclasses import dataclass
from typing import List, TypeVar, Callable, Coroutine, Optional from typing import List, TypeVar, Callable, Coroutine, Optional
import uvicorn import uvicorn
@ -231,6 +232,7 @@ class Driver(ReverseDriver):
self._bot_disconnect(bot) self._bot_disconnect(bot)
@dataclass
class WebSocket(BaseWebSocket): class WebSocket(BaseWebSocket):
websocket: QuartWebSocket = None # type: ignore websocket: QuartWebSocket = None # type: ignore

View File

@ -9,7 +9,7 @@ _running_matcher: Dict[str, int] = {}
@run_preprocessor @run_preprocessor
async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State): async def preprocess(matcher: Matcher, bot: Bot, event: Event, state: T_State):
try: try:
session_id = event.get_session_id() session_id = event.get_session_id()
except Exception: except Exception:
@ -23,7 +23,8 @@ async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State):
@run_postprocessor @run_postprocessor
async def _(matcher: Matcher, exception: Optional[Exception], bot: Bot, event: Event, state: T_State): async def postprocess(matcher: Matcher, exception: Optional[Exception],
bot: Bot, event: Event, state: T_State):
try: try:
session_id = event.get_session_id() session_id = event.get_session_id()
except Exception: except Exception:

View File

@ -7,7 +7,7 @@ test_command = on_command("帮助", to_me())
@test_command.handle() @test_command.handle()
async def test_handler(bot: Bot, event: Event, state: T_State): async def test_handler1(bot: Bot, event: Event, state: T_State):
args = str(event.get_message()).strip() args = str(event.get_message()).strip()
print("[!] Command:", state["_prefix"], "Args:", args) print("[!] Command:", state["_prefix"], "Args:", args)
if args: if args:
@ -17,7 +17,7 @@ async def test_handler(bot: Bot, event: Event, state: T_State):
@test_command.got("help", prompt="你要帮助的命令是?") @test_command.got("help", prompt="你要帮助的命令是?")
async def test_handler(bot: Bot, event: Event, state: T_State): async def test_handler2(bot: Bot, event: Event, state: T_State):
print("[!] Command 帮助:", state["help"]) print("[!] Command 帮助:", state["help"])
if state["help"] not in ["test1", "test2"]: if state["help"] not in ["test1", "test2"]:
await test_command.reject(f"{state['help']} 不支持,请重新输入!") await test_command.reject(f"{state['help']} 不支持,请重新输入!")

View File

@ -9,10 +9,10 @@ test_command = on_startswith("hello", to_me(), permission=SUPERUSER)
@test_command.handle() @test_command.handle()
async def test_handler(bot: CQHTTPBot): async def test_handler1(bot: CQHTTPBot):
await test_command.finish("cqhttp hello") await test_command.finish("cqhttp hello")
@test_command.handle() @test_command.handle()
async def test_handler(bot: DingBot): async def test_handler2(bot: DingBot):
await test_command.finish("ding hello") await test_command.finish("ding hello")