Files
NeoBot/plugins/thpic.py
K2cr2O1 56b1014419 refactor(core): 重构核心模块结构并添加开发文档
将核心模块按功能重新组织为更清晰的结构,包括 managers、handlers 和 utils 目录
添加完整的开发文档,涵盖快速开始、项目结构、核心概念和插件开发指南
更新所有相关模块的导入路径以匹配新的结构
将单例模式实现提取到单独的 singleton.py 文件
2026-01-07 22:51:27 +08:00

32 lines
849 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
thpic 插件
提供 /thpic 指令用于随机返回一个东方Project的图片。
"""
from core.bot import Bot
from core.managers.command_manager import matcher
from models import MessageEvent, MessageSegment
__plugin_meta__ = {
"name": "thpic",
"description": "来看看东方Project的图片吧",
"usage": "/thpic",
}
@matcher.command("thpic")
async def handle_echo(bot: Bot, event: MessageEvent, args: list[str]):
"""
处理 thpic 指令发送一张随机的东方Project图片。
:param bot: Bot 实例(未使用)。
:param event: 消息事件对象。
:param args: 指令参数列表(未使用)。
"""
try:
await event.reply(MessageSegment.image("https://img.paulzzh.com/touhou/random"))
except Exception as e:
await event.reply("报错了。。。" + e)