Files
HeXi/hexi/plugins/nonebot_plugin_group_tools/handlers/chat/voice.py
T
sansenhoshiandClaude 9371a28e35 refactor: restructure plugins per MTSS standard, consolidate assets to res/
Per docs/plugin-audit-report.md (plugins normalized to
Trigger(handlers) → Service(services) → Model(repository/models) + utils):

- Split monolithic __init__.py into handlers/services/utils across
  dailywife, deer_pipe, dice, galgame_card, helldivers_tools,
  huoziyinshua, learning_chat, makeaquote, mc_server_status,
  ncm_saying, picfinder_take, picstatus, random_jm_code, regif,
  steam_info, video_analysis, group_tools
- Move static assets under res/: deer_pipe font/img, makeaquote font,
  helldivers img/templates, huoziyinshua HuoZiYinShua
- Add config.py + register_config_items to ncm_saying, random_jm_code,
  group_tools; learning_chat unified config bridge
- Remove deprecated: voice_trans plugin, bf_bot/test.py, dead code in
  dailywife/deer_pipe, empty dirs, debug scripts under helldivers temp
- Disable brash_general_supercredits_tools (stub comment only)
- bot.py: optional stdout/stderr redirect to log file for Web log viewer,
  force ANSI colorize on non-TTY sinks
- Move runtime data (jm_code.json) out of plugin dir into hexi/data
- Docs: plugin-audit-report.md; README reflects removed plugins

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-03 00:44:38 +08:00

56 lines
1.5 KiB
Python

"""群管理工具 —— 聊天互动(语音)。"""
from __future__ import annotations
from nonebot import on_command, on_fullmatch, on_keyword, require
from nonebot.adapters.onebot.v11 import MessageEvent
from nonebot.rule import to_me
from nonebot_plugin_alconna import UniMessage
from ...constants import BANNED_WORDS, RES_DIR
from ...utils.media import random_audio
require("nonebot_plugin_alconna")
play_zhanshi = on_keyword({"优质的战士"})
@play_zhanshi.handle()
async def play_zhanshi_handle(ev: MessageEvent):
base64_str = random_audio(RES_DIR / "record" / "voice" / "youzhizhanshi")
if base64_str:
await UniMessage.voice(url=base64_str).send()
play_ice = on_fullmatch("溜冰")
@play_ice.handle()
async def play_ice_handle(ev: MessageEvent):
base64_str = random_audio(RES_DIR / "record" / "voice" / "ice")
if base64_str:
await UniMessage.voice(url=base64_str).send()
play_dxl = on_fullmatch("罕见")
@play_dxl.handle()
async def play_dxl_handle(ev: MessageEvent):
base64_str = random_audio(RES_DIR / "record" / "voice" / "dxl")
if base64_str:
await UniMessage.voice(url=base64_str).send()
banned_word_voice = on_command(
"ban_word", aliases=set(BANNED_WORDS), rule=to_me(), block=True
)
@banned_word_voice.handle()
async def banned_word_voice_handle(ev: MessageEvent):
base64_str = random_audio(RES_DIR / "record" / "voice" / "heishou")
if base64_str:
await UniMessage.voice(url=base64_str).send()