2020-09-10 18:31:53 +08:00
|
|
|
from nonebot.rule import to_me
|
2020-12-17 21:09:30 +08:00
|
|
|
from nonebot.typing import T_State
|
2020-09-10 18:31:53 +08:00
|
|
|
from nonebot.plugin import on_startswith
|
2020-12-17 21:09:30 +08:00
|
|
|
from nonebot.permission import SUPERUSER
|
|
|
|
from nonebot.adapters.ding import Bot as DingBot
|
|
|
|
from nonebot.adapters.cqhttp import Bot as CQHTTPBot
|
2020-09-10 18:31:53 +08:00
|
|
|
|
2020-12-17 21:09:30 +08:00
|
|
|
test_command = on_startswith("hello", to_me(), permission=SUPERUSER)
|
2020-09-10 18:31:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
@test_command.handle()
|
2021-06-16 00:58:47 +08:00
|
|
|
async def test_handler1(bot: CQHTTPBot):
|
2020-12-03 18:47:58 +08:00
|
|
|
await test_command.finish("cqhttp hello")
|
|
|
|
|
|
|
|
|
|
|
|
@test_command.handle()
|
2021-06-16 00:58:47 +08:00
|
|
|
async def test_handler2(bot: DingBot):
|
2020-12-03 18:47:58 +08:00
|
|
|
await test_command.finish("ding hello")
|