mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-18 17:35:46 +08:00
45e2e6c280
Fix: 修复 event 类型检查会对类型进行自动转换
31 lines
577 B
Python
31 lines
577 B
Python
from nonebot.adapters import Event, Message
|
|
from nonebot.params import EventToMe, EventType, EventMessage, EventPlainText
|
|
|
|
|
|
async def event(e: Event) -> Event:
|
|
return e
|
|
|
|
|
|
class SubEvent(Event):
|
|
...
|
|
|
|
|
|
async def sub_event(e: SubEvent) -> SubEvent:
|
|
return e
|
|
|
|
|
|
async def event_type(t: str = EventType()) -> str:
|
|
return t
|
|
|
|
|
|
async def event_message(msg: Message = EventMessage()) -> Message:
|
|
return msg
|
|
|
|
|
|
async def event_plain_text(text: str = EventPlainText()) -> str:
|
|
return text
|
|
|
|
|
|
async def event_to_me(to_me: bool = EventToMe()) -> bool:
|
|
return to_me
|