mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
🎨 统一发送格式
This commit is contained in:
@@ -5,7 +5,7 @@ from nonebot import on_message
|
||||
from nonebot.matcher import Matcher
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot.rule import to_me
|
||||
from nonebot_plugin_alconna import Image, UniMessage, UniMsg
|
||||
from nonebot_plugin_alconna import UniMsg
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.path_config import IMAGE_PATH
|
||||
@@ -14,7 +14,9 @@ from zhenxun.models.ban_console import BanConsole
|
||||
from zhenxun.models.group_console import GroupConsole
|
||||
from zhenxun.models.plugin_info import PluginInfo
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils._build_image import BuildImage
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="功能名称当命令检测",
|
||||
@@ -27,7 +29,6 @@ __plugin_meta__ = PluginMetadata(
|
||||
).dict(),
|
||||
)
|
||||
|
||||
|
||||
_matcher = on_message(rule=to_me(), priority=996, block=False)
|
||||
|
||||
|
||||
@@ -52,7 +53,7 @@ async def _(matcher: Matcher, message: UniMsg, session: EventSession):
|
||||
image = None
|
||||
if _path.exists():
|
||||
if files := os.listdir(_path):
|
||||
image = Image(path=_path / random.choice(files))
|
||||
image = _path / random.choice(files)
|
||||
message_list = []
|
||||
if image:
|
||||
message_list.append(image)
|
||||
@@ -62,5 +63,5 @@ async def _(matcher: Matcher, message: UniMsg, session: EventSession):
|
||||
logger.info(
|
||||
f"检测到功能名称当命令使用,已发送帮助信息", "功能帮助", session=session
|
||||
)
|
||||
await UniMessage(message_list).send(reply_to=True)
|
||||
await MessageUtils.build_message(message_list).send(reply_to=True)
|
||||
matcher.stop_propagation()
|
||||
|
||||
Reference in New Issue
Block a user