Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
<grab>[feat]poke
Browse files Browse the repository at this point in the history
  • Loading branch information
HornCopper committed Aug 22, 2024
1 parent ca2ace4 commit 7caef33
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/plugins/grab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions src/plugins/grab/poke.py
Original file line number Diff line number Diff line change
@@ -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"))
19 changes: 10 additions & 9 deletions src/plugins/music/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="请告诉我歌曲名!")

Expand Down

0 comments on commit 7caef33

Please sign in to comment.