From 7caef332766d54241ef8a9fc2bb4be021a9b1d25 Mon Sep 17 00:00:00 2001 From: HornCopper Date: Thu, 22 Aug 2024 19:02:57 +0800 Subject: [PATCH] [feat]poke --- src/plugins/grab/__init__.py | 1 + src/plugins/grab/poke.py | 11 +++++++++++ src/plugins/music/__init__.py | 19 ++++++++++--------- 3 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 src/plugins/grab/poke.py diff --git a/src/plugins/grab/__init__.py b/src/plugins/grab/__init__.py index b239d7c2a..f2a0e3ca7 100644 --- a/src/plugins/grab/__init__.py +++ b/src/plugins/grab/__init__.py @@ -24,6 +24,7 @@ from .joke import * from .bmi import * from .help import * +from .poke import * what_eat = on_regex(r"^(/)?[今|明|后]?[天|日]?(早|中|晚)?(上|午|餐|饭|夜宵|宵夜)?吃(什么|啥|点啥)$", priority=5) what_drink = on_regex(r"^(/)?[今|明|后]?[天|日]?(早|中|晚)?(上|午|餐|饭|夜宵|宵夜)?喝(什么|啥|点啥)$", priority=5) diff --git a/src/plugins/grab/poke.py b/src/plugins/grab/poke.py new file mode 100644 index 000000000..3381fd10d --- /dev/null +++ b/src/plugins/grab/poke.py @@ -0,0 +1,11 @@ +from nonebot.adapters.onebot.v11 import PokeNotifyEvent, MessageSegment as ms +from nonebot import on_notice + +poke_me = on_notice(priority=5) + +@poke_me.handle() +async def _(event: PokeNotifyEvent): + if event.group_id == None: + return + else: + await poke_me.finish("音卡在呢!找音卡有什么事吗!(^ω^)" + ms.image("https://inkar-suki.codethink.cn/Inkar-Suki-Docs/img/emoji.jpg")) \ No newline at end of file diff --git a/src/plugins/music/__init__.py b/src/plugins/music/__init__.py index 957981b8f..6c95535b8 100644 --- a/src/plugins/music/__init__.py +++ b/src/plugins/music/__init__.py @@ -111,15 +111,16 @@ async def _(event: GroupMessageEvent, args: Message = CommandArg()): async def _(event: GroupMessageEvent, state: T_State, args: Message = CommandArg()): if args.extract_plain_text() != "": return - rd = getRandomMusic() - input = rd[1] - name = rd[0] - logger.info(name) - state["ans"] = name[:-4] - output = CACHE + "/" + get_uuid() + ".mp3" - await extract_music(input, output, 3) - await guess_music.send(ms.record(file=Path(output).as_uri())) - return + await guess_music.finish(ms.record(file=Path("C:/Users/HornCopper/Inkar-Suki/src/assets/music/1.mp3").as_uri())) + # rd = getRandomMusic() + # input = rd[1] + # name = rd[0] + # logger.info(name) + # state["ans"] = name[:-4] + # output = CACHE + "/" + get_uuid() + ".mp3" + # await extract_music(input, output, 3) + # await guess_music.send(ms.record(file=Path(output).as_uri())) + # return @guess_music.got("music", prompt="请告诉我歌曲名!")