mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
✨ 钉宫骂我
This commit is contained in:
parent
dfbb7f347e
commit
1a8378f433
@ -279,7 +279,6 @@ async def _(
|
||||
text: Match[str],
|
||||
groups: Match[str],
|
||||
):
|
||||
# TODO: 指定多个群
|
||||
greetings = "恭喜发财 大吉大利"
|
||||
if text.available:
|
||||
greetings = text.result
|
||||
|
||||
5
zhenxun/plugins/send_voice/__init__.py
Normal file
5
zhenxun/plugins/send_voice/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
from pathlib import Path
|
||||
|
||||
import nonebot
|
||||
|
||||
nonebot.load_plugins(str(Path(__file__).parent.resolve()))
|
||||
51
zhenxun/plugins/send_voice/dinggong.py
Normal file
51
zhenxun/plugins/send_voice/dinggong.py
Normal file
@ -0,0 +1,51 @@
|
||||
import os
|
||||
import random
|
||||
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot.rule import to_me
|
||||
from nonebot_plugin_alconna import Alconna, Arparma, UniMessage, Voice, on_alconna
|
||||
from nonebot_plugin_saa import Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.path_config import RECORD_PATH
|
||||
from zhenxun.configs.utils import PluginCdBlock, PluginExtraData
|
||||
from zhenxun.services.log import logger
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="钉宫骂我",
|
||||
description="请狠狠的骂我一次!",
|
||||
usage="""
|
||||
多骂我一点,球球了
|
||||
指令:
|
||||
骂老子
|
||||
""".strip(),
|
||||
extra=PluginExtraData(
|
||||
author="HibiKier",
|
||||
version="0.1",
|
||||
limits=[PluginCdBlock(cd=3, result="就...就算求我骂你也得慢慢来...")],
|
||||
).dict(),
|
||||
)
|
||||
|
||||
_matcher = on_alconna(Alconna("ma-wo"), rule=to_me(), priority=5, block=True)
|
||||
|
||||
_matcher.shortcut(
|
||||
r".*?骂.*?我.*?",
|
||||
command="ma-wo",
|
||||
arguments=[],
|
||||
prefix=True,
|
||||
)
|
||||
|
||||
path = RECORD_PATH / "dinggong"
|
||||
|
||||
|
||||
@_matcher.handle()
|
||||
async def _(session: EventSession, arparma: Arparma):
|
||||
if not path.exists():
|
||||
await Text("钉宫语音文件夹不存在...").finish()
|
||||
files = os.listdir(path)
|
||||
if not files:
|
||||
await Text("钉宫语音文件夹为空...").finish()
|
||||
voice = random.choice(files)
|
||||
await UniMessage([Voice(path=path / voice)]).send()
|
||||
await Text(voice.split("_")[1]).send()
|
||||
logger.info(f"发送钉宫骂人: {voice}", arparma.header_result, session=session)
|
||||
Loading…
Reference in New Issue
Block a user