mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-19 01:18:19 +08:00
🚨 remove linter error
This commit is contained in:
parent
8849cb73bb
commit
6749afe75e
@ -9,6 +9,7 @@ Quart 驱动适配
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
from typing import List, TypeVar, Callable, Coroutine, Optional
|
||||
|
||||
import uvicorn
|
||||
@ -231,6 +232,7 @@ class Driver(ReverseDriver):
|
||||
self._bot_disconnect(bot)
|
||||
|
||||
|
||||
@dataclass
|
||||
class WebSocket(BaseWebSocket):
|
||||
websocket: QuartWebSocket = None # type: ignore
|
||||
|
||||
|
@ -9,7 +9,7 @@ _running_matcher: Dict[str, int] = {}
|
||||
|
||||
|
||||
@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:
|
||||
session_id = event.get_session_id()
|
||||
except Exception:
|
||||
@ -23,7 +23,8 @@ async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State):
|
||||
|
||||
|
||||
@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:
|
||||
session_id = event.get_session_id()
|
||||
except Exception:
|
||||
|
@ -7,7 +7,7 @@ test_command = on_command("帮助", to_me())
|
||||
|
||||
|
||||
@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()
|
||||
print("[!] Command:", state["_prefix"], "Args:", args)
|
||||
if args:
|
||||
@ -17,7 +17,7 @@ async def test_handler(bot: Bot, event: Event, state: T_State):
|
||||
|
||||
|
||||
@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"])
|
||||
if state["help"] not in ["test1", "test2"]:
|
||||
await test_command.reject(f"{state['help']} 不支持,请重新输入!")
|
||||
|
@ -9,10 +9,10 @@ test_command = on_startswith("hello", to_me(), permission=SUPERUSER)
|
||||
|
||||
|
||||
@test_command.handle()
|
||||
async def test_handler(bot: CQHTTPBot):
|
||||
async def test_handler1(bot: CQHTTPBot):
|
||||
await test_command.finish("cqhttp hello")
|
||||
|
||||
|
||||
@test_command.handle()
|
||||
async def test_handler(bot: DingBot):
|
||||
async def test_handler2(bot: DingBot):
|
||||
await test_command.finish("ding hello")
|
||||
|
Loading…
Reference in New Issue
Block a user