mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
🐛 fix builtin bug
This commit is contained in:
parent
8f3978f2b2
commit
e942f4076c
@ -156,7 +156,7 @@ class BotParam(Param):
|
||||
):
|
||||
return cls(Required)
|
||||
|
||||
def _solve(self, bot: Bot, **kwargs: Any) -> Any:
|
||||
async def _solve(self, bot: Bot, **kwargs: Any) -> Any:
|
||||
return bot
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ class EventParam(Param):
|
||||
):
|
||||
return cls(Required)
|
||||
|
||||
def _solve(self, event: Event, **kwargs: Any) -> Any:
|
||||
async def _solve(self, event: Event, **kwargs: Any) -> Any:
|
||||
return event
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ class StateParam(Param):
|
||||
if isinstance(param.default, StateInner):
|
||||
return cls(Required)
|
||||
|
||||
def _solve(self, state: T_State, **kwargs: Any) -> Any:
|
||||
async def _solve(self, state: T_State, **kwargs: Any) -> Any:
|
||||
return state
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ class MatcherParam(Param):
|
||||
):
|
||||
return cls(Required)
|
||||
|
||||
def _solve(self, matcher: "Matcher", **kwargs: Any) -> Any:
|
||||
async def _solve(self, matcher: "Matcher", **kwargs: Any) -> Any:
|
||||
return matcher
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@ class ExceptionParam(Param):
|
||||
):
|
||||
return cls(Required)
|
||||
|
||||
def _solve(self, exception: Optional[Exception] = None, **kwargs: Any) -> Any:
|
||||
async def _solve(self, exception: Optional[Exception] = None, **kwargs: Any) -> Any:
|
||||
return exception
|
||||
|
||||
|
||||
@ -231,7 +231,7 @@ class DefaultParam(Param):
|
||||
if param.default != param.empty:
|
||||
return cls(param.default)
|
||||
|
||||
def _solve(self, **kwargs: Any) -> Any:
|
||||
async def _solve(self, **kwargs: Any) -> Any:
|
||||
return Undefined
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ import inspect
|
||||
from types import ModuleType
|
||||
from typing import Any, Set, Dict, List, Type, Tuple, Union, Optional
|
||||
|
||||
from nonebot.params import State
|
||||
from nonebot.adapters import Event
|
||||
from nonebot.matcher import Matcher
|
||||
from .manager import _current_plugin
|
||||
@ -393,7 +394,7 @@ def on_command(
|
||||
- ``Type[Matcher]``
|
||||
"""
|
||||
|
||||
async def _strip_cmd(event: Event, state: T_State):
|
||||
async def _strip_cmd(event: Event, state: T_State = State()):
|
||||
message = event.get_message()
|
||||
if len(message) < 1:
|
||||
return
|
||||
@ -451,7 +452,7 @@ def on_shell_command(
|
||||
- ``Type[Matcher]``
|
||||
"""
|
||||
|
||||
async def _strip_cmd(event: Event, state: T_State):
|
||||
async def _strip_cmd(event: Event, state: T_State = State()):
|
||||
message = event.get_message()
|
||||
segment = message.pop(0)
|
||||
new_message = message.__class__(
|
||||
|
Loading…
Reference in New Issue
Block a user