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>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
"""聊天类触发(handlers/chat)。"""
|
||||
|
||||
from . import greet, reaction, voice # noqa: F401
|
||||
@@ -0,0 +1,94 @@
|
||||
"""群管理工具 —— 聊天互动(问候/尬聊)。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from nonebot import get_driver, on_command, on_fullmatch, on_keyword, require
|
||||
from nonebot.adapters.onebot.v11 import Bot, MessageEvent
|
||||
from nonebot.rule import to_me
|
||||
from nonebot_plugin_alconna import UniMessage
|
||||
|
||||
from ...constants import RES_DIR
|
||||
from ...services.moderation import silence
|
||||
from ...utils.media import image_to_base64
|
||||
|
||||
require("nonebot_plugin_alconna")
|
||||
|
||||
SUPERUSERS = get_driver().config.superusers
|
||||
|
||||
say_hello = on_command(
|
||||
"zai?",
|
||||
aliases={"在?", "在?", "在吗", "在么?", "在嘛", "在嘛?"},
|
||||
rule=to_me(),
|
||||
block=True,
|
||||
)
|
||||
|
||||
|
||||
@say_hello.handle()
|
||||
async def say_hello_handle(ev: MessageEvent):
|
||||
await UniMessage.text("はい!私はいつも貴方の側にいますよ!").send()
|
||||
|
||||
|
||||
say_sorry = on_fullmatch("沙雕机器人")
|
||||
|
||||
|
||||
@say_sorry.handle()
|
||||
async def say_sorry_handle(ev: MessageEvent):
|
||||
await UniMessage.text("ごめんなさい!嘤嘤嘤(〒︿〒)").send()
|
||||
|
||||
|
||||
say_heweidao = on_keyword({"何意味"})
|
||||
|
||||
|
||||
@say_heweidao.handle()
|
||||
async def say_heweidao_handle(ev: MessageEvent):
|
||||
await UniMessage.text("何意味是什么意思喵~").send()
|
||||
|
||||
|
||||
chat_waifu = on_fullmatch(("老婆", "waifu", "laopo"), rule=to_me())
|
||||
|
||||
|
||||
@chat_waifu.handle()
|
||||
async def chat_waifu_handle(ev: MessageEvent):
|
||||
is_superuser = str(ev.user_id) in SUPERUSERS
|
||||
img_name = "love.jpg" if is_superuser else "laopo.jpg"
|
||||
base64_str = image_to_base64(RES_DIR / "img" / img_name)
|
||||
if not base64_str:
|
||||
return
|
||||
if is_superuser:
|
||||
msg = UniMessage.text("mua~") + UniMessage.image(url=base64_str)
|
||||
else:
|
||||
msg = UniMessage.image(url=base64_str)
|
||||
await msg.send()
|
||||
|
||||
|
||||
chat_laogong = on_fullmatch("老公", rule=to_me())
|
||||
|
||||
|
||||
@chat_laogong.handle()
|
||||
async def chat_laogong_handle(ev: MessageEvent):
|
||||
await UniMessage.text("你给我滚!").send(at_sender=True)
|
||||
|
||||
|
||||
chat_mua = on_fullmatch("mua", rule=to_me())
|
||||
|
||||
|
||||
@chat_mua.handle()
|
||||
async def chat_mua_handle(ev: MessageEvent):
|
||||
await UniMessage.text("笨蛋~").send(at_sender=True)
|
||||
|
||||
|
||||
ddhaole = on_fullmatch(("我有个朋友说他好了", "我朋友说他好了"))
|
||||
|
||||
|
||||
@ddhaole.handle()
|
||||
async def ddhaole_handle(bot: Bot, ev: MessageEvent):
|
||||
await UniMessage.text("那个朋友是不是你弟弟?").send()
|
||||
await silence(bot, ev, 30)
|
||||
|
||||
|
||||
nihaole = on_fullmatch("我好了")
|
||||
|
||||
|
||||
@nihaole.handle()
|
||||
async def nihaole_handle(bot: Bot, ev: MessageEvent):
|
||||
await UniMessage.text("不许好,憋回去!").send()
|
||||
@@ -0,0 +1,37 @@
|
||||
"""群管理工具 —— 聊天互动(概率表情)。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
|
||||
from nonebot import require
|
||||
from nonebot.adapters.onebot.v11 import MessageEvent
|
||||
from nonebot_plugin_alconna import UniMessage
|
||||
from nonebot import on_keyword
|
||||
|
||||
from ...constants import RES_DIR
|
||||
from ...utils.media import image_to_base64
|
||||
|
||||
require("nonebot_plugin_alconna")
|
||||
|
||||
|
||||
chat_queshi = on_keyword({"确实", "有一说一", "u1s1", "yysy"})
|
||||
|
||||
|
||||
@chat_queshi.handle()
|
||||
async def chat_queshi_handle(ev: MessageEvent):
|
||||
if random.random() < 0.05:
|
||||
base64_str = image_to_base64(RES_DIR / "img" / "确实.jpg")
|
||||
if base64_str:
|
||||
await UniMessage.image(url=base64_str).send()
|
||||
|
||||
|
||||
chat_neigui = on_keyword({"内鬼"})
|
||||
|
||||
|
||||
@chat_neigui.handle()
|
||||
async def chat_neigui_handle(ev: MessageEvent):
|
||||
if random.random() < 0.10:
|
||||
base64_str = image_to_base64(RES_DIR / "img" / "内鬼.png")
|
||||
if base64_str:
|
||||
await UniMessage.image(url=base64_str).send()
|
||||
@@ -0,0 +1,55 @@
|
||||
"""群管理工具 —— 聊天互动(语音)。"""
|
||||
|
||||
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()
|
||||
Reference in New Issue
Block a user