🔥 remove cqhttp files

This commit is contained in:
yanyongyu
2021-11-23 16:21:21 +08:00
parent db5d4d7acf
commit 286729f703
26 changed files with 8 additions and 4016 deletions

View File

@ -4,7 +4,6 @@ import sys
sys.path.insert(0, os.path.abspath(".."))
import nonebot
from nonebot.adapters.cqhttp import Bot
from nonebot.log import logger, default_format
from nonebot.adapters.ding import Bot as DingBot
from nonebot.adapters.mirai import Bot as MiraiBot
@ -18,7 +17,6 @@ logger.add(
nonebot.init(custom_config2="config on init")
app = nonebot.get_asgi()
driver = nonebot.get_driver()
driver.register_adapter("cqhttp", Bot)
driver.register_adapter("ding", DingBot)
driver.register_adapter("mirai", MiraiBot)
driver.register_adapter("feishu", FeishuBot)

View File

@ -4,4 +4,4 @@ from nonebot import CommandGroup, MatcherGroup
cmd = CommandGroup("test", rule=to_me())
match = MatcherGroup(priority=2)
from . import matches, commands
from . import commands

View File

@ -1,16 +0,0 @@
from . import match
from nonebot.typing import T_State
from nonebot.adapters import Bot, Event
from nonebot.adapters.cqhttp import HeartbeatMetaEvent
async def heartbeat(bot: Bot, event: Event, state: T_State) -> bool:
return isinstance(event, HeartbeatMetaEvent)
test = match.on_metaevent(rule=heartbeat)
@test.receive()
async def handle_heartbeat(bot: Bot):
print("[i] Heartbeat")

View File

@ -1,21 +0,0 @@
from nonebot.typing import T_State
from nonebot.adapters import Bot, Event
from nonebot.plugin import on_metaevent
from nonebot.adapters.cqhttp import HeartbeatMetaEvent
async def heartbeat(bot: Bot, event: Event, state: T_State) -> bool:
return isinstance(event, HeartbeatMetaEvent)
async def factory(bot: Bot, event: Event) -> T_State:
return {"factory": True}
test_matcher = on_metaevent(heartbeat, state_factory=factory)
@test_matcher.receive()
async def handle_heartbeat(bot: Bot, event: Event, state: T_State):
print(state)
print("[i] Heartbeat")

View File

@ -1,19 +0,0 @@
from nonebot import on_command
from nonebot.adapters.cqhttp import Bot, GroupMessageEvent, PrivateMessageEvent
overload = on_command("overload")
@overload.handle()
async def handle_first_receive(bot: Bot):
return
@overload.got("message", prompt="群?")
async def handle_group(bot: Bot, event: GroupMessageEvent):
return
@overload.got("message", prompt="私?")
async def handle_private(bot: Bot, event: PrivateMessageEvent):
return

View File

@ -1,18 +0,0 @@
from nonebot.rule import to_me
from nonebot.typing import T_State
from nonebot.permission import SUPERUSER
from nonebot.plugin import on_startswith
from nonebot.adapters.ding import Bot as DingBot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot
test_command = on_startswith("hello", to_me(), permission=SUPERUSER)
@test_command.handle()
async def test_handler1(bot: CQHTTPBot):
await test_command.finish("cqhttp hello")
@test_command.handle()
async def test_handler2(bot: DingBot):
await test_command.finish("ding hello")

View File

@ -1,14 +0,0 @@
from nonebot import on_command
from nonebot.typing import T_State
from nonebot.adapters.cqhttp import Bot, MessageSegment, GroupMessageEvent
template = on_command("template")
@template.handle()
async def _(bot: Bot, event: GroupMessageEvent, state: T_State):
state["at"] = MessageSegment.at(event.get_user_id())
state["test"] = "test"
# message: /template {at} hello {test}!
ft = event.message.template(event.message)
await template.send(ft)