mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 00:31:14 +00:00
🎨 impove typing
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from nonebot.typing import Bot, Event
|
||||
from nonebot.typing import State
|
||||
from nonebot.adapters import Bot, Event
|
||||
from nonebot.permission import GROUP_OWNER
|
||||
|
||||
from . import cmd
|
||||
@ -7,5 +8,5 @@ test_1 = cmd.command("1", aliases={"test"}, permission=GROUP_OWNER)
|
||||
|
||||
|
||||
@test_1.handle()
|
||||
async def test1(bot: Bot, event: Event, state: dict):
|
||||
async def test1(bot: Bot, event: Event, state: State):
|
||||
await test_1.finish(event.raw_message)
|
||||
|
@ -1,9 +1,10 @@
|
||||
from nonebot.typing import Bot, Event
|
||||
from nonebot.typing import State
|
||||
from nonebot.adapters import Bot, Event
|
||||
|
||||
from . import match
|
||||
|
||||
|
||||
async def heartbeat(bot: Bot, event: Event, state: dict) -> bool:
|
||||
async def heartbeat(bot: Bot, event: Event, state: State) -> bool:
|
||||
return event.detail_type == "heartbeat"
|
||||
|
||||
|
||||
@ -11,5 +12,5 @@ test = match.on_metaevent(rule=heartbeat)
|
||||
|
||||
|
||||
@test.receive()
|
||||
async def handle_heartbeat(bot: Bot, event: Event, state: dict):
|
||||
async def handle_heartbeat(bot: Bot, event: Event, state: State):
|
||||
print("[i] Heartbeat")
|
||||
|
Reference in New Issue
Block a user