mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-06-06 12:26:38 +00:00
🚨 remove linter error
This commit is contained in:
parent
8849cb73bb
commit
6749afe75e
@ -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
|
||||||
|
|
||||||
|
@ -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:
|
||||||
|
@ -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']} 不支持,请重新输入!")
|
||||||
|
@ -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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user