mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
🎨 统一发送格式
This commit is contained in:
@@ -2,7 +2,6 @@ import nonebot
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot_plugin_alconna import Alconna, Arparma, on_alconna
|
||||
from nonebot_plugin_alconna.matcher import AlconnaMatcher
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.path_config import IMAGE_PATH
|
||||
@@ -18,6 +17,7 @@ from zhenxun.utils.image_utils import (
|
||||
group_image,
|
||||
text2image,
|
||||
)
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.rules import admin_check, ensure_group
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
@@ -149,13 +149,12 @@ async def build_help() -> BuildImage:
|
||||
@_matcher.handle()
|
||||
async def _(
|
||||
session: EventSession,
|
||||
matcher: AlconnaMatcher,
|
||||
arparma: Arparma,
|
||||
):
|
||||
if not ADMIN_HELP_IMAGE.exists():
|
||||
try:
|
||||
await build_help()
|
||||
except EmptyError:
|
||||
await Text("管理员帮助为空").finish(reply=True)
|
||||
await Image(ADMIN_HELP_IMAGE).send()
|
||||
await MessageUtils.build_message("管理员帮助为空").finish(reply=True)
|
||||
await MessageUtils.build_message(ADMIN_HELP_IMAGE).send()
|
||||
logger.info("查看管理员帮助", arparma.header_result, session=session)
|
||||
|
||||
@@ -11,13 +11,13 @@ from nonebot_plugin_alconna import (
|
||||
on_alconna,
|
||||
store_true,
|
||||
)
|
||||
from nonebot_plugin_saa import Image, Mention, MessageFactory, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.config import Config
|
||||
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.rules import admin_check
|
||||
|
||||
from ._data_source import BanManage
|
||||
@@ -146,9 +146,9 @@ async def _(
|
||||
_user_id = user_id.result if user_id.available else None
|
||||
_group_id = group_id.result if group_id.available else None
|
||||
if image := await BanManage.build_ban_image(filter_type, _user_id, _group_id):
|
||||
await Image(image.pic2bytes()).finish(reply=True)
|
||||
await MessageUtils.build_message(image).finish(reply_to=True)
|
||||
else:
|
||||
await Text("数据为空捏...").finish(reply=True)
|
||||
await MessageUtils.build_message("数据为空捏...").finish(reply_to=True)
|
||||
|
||||
|
||||
@_ban_matcher.handle()
|
||||
@@ -166,7 +166,7 @@ async def _(
|
||||
user_id = user.result.target
|
||||
else:
|
||||
if session.id1 not in bot.config.superusers:
|
||||
await Text("权限不足捏...").finish(reply=True)
|
||||
await MessageUtils.build_message("权限不足捏...").finish(reply_to=True)
|
||||
user_id = user.result
|
||||
_duration = duration.result * 60 if duration.available else -1
|
||||
if (gid := session.id3 or session.id2) and not group_id.available:
|
||||
@@ -181,13 +181,13 @@ async def _(
|
||||
session=session,
|
||||
target=f"{gid}:{user_id}",
|
||||
)
|
||||
await MessageFactory(
|
||||
await MessageUtils.build_message(
|
||||
[
|
||||
Text("对 "),
|
||||
Mention(user_id) if isinstance(user.result, At) else Text(user_id), # type: ignore
|
||||
Text(f" 狠狠惩戒了一番,一脚踢进了小黑屋!"),
|
||||
"对 ",
|
||||
At(flag="user", target=user_id) if isinstance(user.result, At) else user_id, # type: ignore
|
||||
f" 狠狠惩戒了一番,一脚踢进了小黑屋!",
|
||||
]
|
||||
).finish(reply=True)
|
||||
).finish(reply_to=True)
|
||||
elif session.id1 in bot.config.superusers:
|
||||
_group_id = group_id.result if group_id.available else None
|
||||
await BanManage.ban(user_id, _group_id, _duration, session, True)
|
||||
@@ -198,7 +198,9 @@ async def _(
|
||||
target=f"{_group_id}:{user_id}",
|
||||
)
|
||||
at_msg = user_id if user_id else f"群组:{_group_id}"
|
||||
await Text(f"对 {at_msg} 狠狠惩戒了一番,一脚踢进了小黑屋!").finish(reply=True)
|
||||
await MessageUtils.build_message(
|
||||
f"对 {at_msg} 狠狠惩戒了一番,一脚踢进了小黑屋!"
|
||||
).finish(reply_to=True)
|
||||
|
||||
|
||||
@_unban_matcher.handle()
|
||||
@@ -215,7 +217,7 @@ async def _(
|
||||
user_id = user.result.target
|
||||
else:
|
||||
if session.id1 not in bot.config.superusers:
|
||||
await Text("权限不足捏...").finish(reply=True)
|
||||
await MessageUtils.build_message("权限不足捏...").finish(reply_to=True)
|
||||
user_id = user.result
|
||||
if gid := session.id3 or session.id2:
|
||||
if group_id.available:
|
||||
@@ -229,15 +231,17 @@ async def _(
|
||||
session=session,
|
||||
target=f"{gid}:{user_id}",
|
||||
)
|
||||
await MessageFactory(
|
||||
await MessageUtils.build_message(
|
||||
[
|
||||
Text("将 "),
|
||||
Mention(user_id) if isinstance(user.result, At) else Text(user_id), # type: ignore
|
||||
Text(f" 从黑屋中拉了出来并急救了一下!"),
|
||||
"将 ",
|
||||
At(flag="user", target=user_id) if isinstance(user.result, At) else user_id, # type: ignore
|
||||
f" 从黑屋中拉了出来并急救了一下!",
|
||||
]
|
||||
).finish(reply=True)
|
||||
else:
|
||||
await Text(f"该用户不在黑名单中捏...").finish(reply=True)
|
||||
await MessageUtils.build_message(f"该用户不在黑名单中捏...").finish(
|
||||
reply_to=True
|
||||
)
|
||||
elif session.id1 in bot.config.superusers:
|
||||
_group_id = group_id.result if group_id.available else None
|
||||
if await BanManage.unban(user_id, _group_id, session, True):
|
||||
@@ -248,6 +252,10 @@ async def _(
|
||||
target=f"{_group_id}:{user_id}",
|
||||
)
|
||||
at_msg = user_id if user_id else f"群组:{_group_id}"
|
||||
await Text(f"对 {at_msg} 从黑屋中拉了出来并急救了一下!").finish(reply=True)
|
||||
await MessageUtils.build_message(
|
||||
f"对 {at_msg} 从黑屋中拉了出来并急救了一下!"
|
||||
).finish(reply_to=True)
|
||||
else:
|
||||
await Text(f"该用户不在黑名单中捏...").finish(reply=True)
|
||||
await MessageUtils.build_message(f"该用户不在黑名单中捏...").finish(
|
||||
reply_to=True
|
||||
)
|
||||
|
||||
@@ -102,7 +102,7 @@ class BanManage:
|
||||
user_level = 9999
|
||||
if not is_superuser and user_id and session.id1:
|
||||
user_level = await LevelUser.get_user_level(session.id1, group_id)
|
||||
if not await BanConsole.check_ban_level(user_id, group_id, user_level):
|
||||
if await BanConsole.check_ban_level(user_id, group_id, user_level):
|
||||
await BanConsole.unban(user_id, group_id)
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -3,13 +3,13 @@ from nonebot.adapters import Bot
|
||||
from nonebot.adapters.onebot.v11 import GroupIncreaseNoticeEvent
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot_plugin_alconna import Alconna, Arparma, on_alconna
|
||||
from nonebot_plugin_saa import Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.config import NICKNAME
|
||||
from zhenxun.configs.utils import PluginExtraData
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.rules import admin_check, ensure_group
|
||||
|
||||
from ._data_source import MemberUpdateManage
|
||||
@@ -44,8 +44,10 @@ async def _(bot: Bot, session: EventSession, arparma: Arparma):
|
||||
if gid := session.id3 or session.id2:
|
||||
logger.info("更新群组成员信息", arparma.header_result, session=session)
|
||||
await MemberUpdateManage.update(bot, gid)
|
||||
await Text("已经成功更新了群组成员信息!").finish(reply=True)
|
||||
await Text("群组id为空...").send()
|
||||
await MessageUtils.build_message("已经成功更新了群组成员信息!").finish(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message("群组id为空...").send()
|
||||
|
||||
|
||||
_notice = on_notice(priority=1, block=False)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from nonebot.adapters import Bot
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot_plugin_alconna import AlconnaQuery, Arparma, Match, Query
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.config import Config
|
||||
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import BlockType, PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
from ._data_source import PluginManage, build_plugin, build_task
|
||||
from .command import _group_status_matcher, _status_matcher
|
||||
@@ -98,9 +98,9 @@ async def _(
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
await Image(image.pic2bytes()).finish(reply=True)
|
||||
await MessageUtils.build_message(image).finish(reply_to=True)
|
||||
else:
|
||||
await Text("权限不足捏...").finish(reply=True)
|
||||
await MessageUtils.build_message("权限不足捏...").finish(reply_to=True)
|
||||
|
||||
|
||||
@_status_matcher.assign("open")
|
||||
@@ -115,7 +115,7 @@ async def _(
|
||||
all: Query[bool] = AlconnaQuery("all.value", False),
|
||||
):
|
||||
if not all.result and not plugin_name.available:
|
||||
await Text("请输入功能名称").finish(reply=True)
|
||||
await MessageUtils.build_message("请输入功能名称").finish(reply_to=True)
|
||||
name = plugin_name.result
|
||||
gid = session.id3 or session.id2
|
||||
if gid:
|
||||
@@ -154,7 +154,7 @@ async def _(
|
||||
logger.info(
|
||||
f"开启功能 {name}", arparma.header_result, session=session
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
elif session.id1 in bot.config.superusers:
|
||||
"""私聊"""
|
||||
group_id = group.result if group.available else None
|
||||
@@ -174,7 +174,7 @@ async def _(
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
if default_status.result:
|
||||
result = await PluginManage.set_default_status(name, True)
|
||||
logger.info(
|
||||
@@ -183,7 +183,7 @@ async def _(
|
||||
session=session,
|
||||
target=group_id,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
if task.result:
|
||||
split_list = name.split()
|
||||
if len(split_list) > 1:
|
||||
@@ -204,7 +204,7 @@ async def _(
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
else:
|
||||
result = await PluginManage.superuser_block(name, None, group_id)
|
||||
logger.info(
|
||||
@@ -213,7 +213,7 @@ async def _(
|
||||
session=session,
|
||||
target=group_id,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
|
||||
|
||||
@_status_matcher.assign("close")
|
||||
@@ -229,7 +229,7 @@ async def _(
|
||||
all: Query[bool] = AlconnaQuery("all.value", False),
|
||||
):
|
||||
if not all.result and not plugin_name.available:
|
||||
await Text("请输入功能名称").finish(reply=True)
|
||||
await MessageUtils.build_message("请输入功能名称").finish(reply_to=True)
|
||||
name = plugin_name.result
|
||||
gid = session.id3 or session.id2
|
||||
if gid:
|
||||
@@ -268,7 +268,7 @@ async def _(
|
||||
logger.info(
|
||||
f"关闭功能 {name}", arparma.header_result, session=session
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
elif session.id1 in bot.config.superusers:
|
||||
group_id = group.result if group.available else None
|
||||
if all.result:
|
||||
@@ -287,7 +287,7 @@ async def _(
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
if default_status.result:
|
||||
result = await PluginManage.set_default_status(name, False)
|
||||
logger.info(
|
||||
@@ -296,7 +296,7 @@ async def _(
|
||||
session=session,
|
||||
target=group_id,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
if task.result:
|
||||
split_list = name.split()
|
||||
if len(split_list) > 1:
|
||||
@@ -317,7 +317,7 @@ async def _(
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
else:
|
||||
_type = BlockType.ALL
|
||||
if block_type.available:
|
||||
@@ -332,7 +332,7 @@ async def _(
|
||||
session=session,
|
||||
target=group_id,
|
||||
)
|
||||
await Text(result).finish(reply=True)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
|
||||
|
||||
@_group_status_matcher.handle()
|
||||
@@ -345,14 +345,14 @@ async def _(
|
||||
if status == "sleep":
|
||||
await PluginManage.sleep(gid)
|
||||
logger.info("进行休眠", arparma.header_result, session=session)
|
||||
await Text("那我先睡觉了...").finish()
|
||||
await MessageUtils.build_message("那我先睡觉了...").finish()
|
||||
else:
|
||||
if await PluginManage.is_wake(gid):
|
||||
await Text("我还醒着呢!").finish()
|
||||
await MessageUtils.build_message("我还醒着呢!").finish()
|
||||
await PluginManage.wake(gid)
|
||||
logger.info("醒来", arparma.header_result, session=session)
|
||||
await Text("呜..醒来了...").finish()
|
||||
return Text("群组id为空...").send()
|
||||
await MessageUtils.build_message("呜..醒来了...").finish()
|
||||
return MessageUtils.build_message("群组id为空...").send()
|
||||
|
||||
|
||||
@_status_matcher.assign("task")
|
||||
@@ -367,6 +367,6 @@ async def _(
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
)
|
||||
await Image(image.pic2bytes()).finish(reply=True)
|
||||
await MessageUtils.build_message(image).finish(reply_to=True)
|
||||
else:
|
||||
await Text("获取群被动任务失败...").finish(reply=True)
|
||||
await MessageUtils.build_message("获取群被动任务失败...").finish(reply_to=True)
|
||||
|
||||
@@ -12,7 +12,6 @@ from nonebot_plugin_alconna import (
|
||||
on_alconna,
|
||||
store_true,
|
||||
)
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.utils import PluginExtraData
|
||||
@@ -21,6 +20,7 @@ from zhenxun.models.group_member_info import GroupInfoUser
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.image_utils import ImageTemplate
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="消息统计",
|
||||
@@ -120,8 +120,8 @@ async def _(
|
||||
logger.info(
|
||||
f"查看消息排行 数量={count.result}", arparma.header_result, session=session
|
||||
)
|
||||
await Image(A.pic2bytes()).finish(reply=True)
|
||||
await Text("群组消息记录为空...").finish()
|
||||
await MessageUtils.build_message(A).finish(reply_to=True)
|
||||
await MessageUtils.build_message("群组消息记录为空...").finish()
|
||||
|
||||
|
||||
# # @test.handle()
|
||||
|
||||
@@ -11,7 +11,6 @@ from nonebot_plugin_alconna import (
|
||||
on_alconna,
|
||||
store_true,
|
||||
)
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.path_config import IMAGE_PATH
|
||||
@@ -19,6 +18,7 @@ from zhenxun.configs.utils import PluginExtraData, RegisterConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.image_utils import BuildImage
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
from ._data_source import create_help_img, get_plugin_help
|
||||
from ._utils import GROUP_HELP_PATH
|
||||
@@ -75,11 +75,13 @@ async def _(
|
||||
_is_superuser = False
|
||||
if result := await get_plugin_help(name.result, _is_superuser):
|
||||
if isinstance(result, BuildImage):
|
||||
await Image(result.pic2bytes()).send(reply=True)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
else:
|
||||
await Text(result).send(reply=True)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
else:
|
||||
await Text("没有此功能的帮助信息...").send(reply=True)
|
||||
await MessageUtils.build_message("没有此功能的帮助信息...").send(
|
||||
reply_to=True
|
||||
)
|
||||
logger.info(
|
||||
f"查看帮助详情: {name.result}",
|
||||
"帮助",
|
||||
@@ -90,10 +92,10 @@ async def _(
|
||||
_image_path = GROUP_HELP_PATH / f"{gid}.png"
|
||||
if not _image_path.exists():
|
||||
await create_help_img(gid)
|
||||
await Image(_image_path).finish()
|
||||
await MessageUtils.build_message(_image_path).finish()
|
||||
else:
|
||||
if not SIMPLE_HELP_IMAGE.exists():
|
||||
if SIMPLE_HELP_IMAGE.exists():
|
||||
SIMPLE_HELP_IMAGE.unlink()
|
||||
await create_help_img(None)
|
||||
await Image(SIMPLE_HELP_IMAGE).finish()
|
||||
await MessageUtils.build_message(SIMPLE_HELP_IMAGE).finish()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -7,7 +7,6 @@ from nonebot.params import Depends, RegexGroup
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot.rule import to_me
|
||||
from nonebot_plugin_alconna import Alconna, Option, on_alconna, store_true
|
||||
from nonebot_plugin_saa import Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
from nonebot_plugin_userinfo import EventUserInfo, UserInfo
|
||||
|
||||
@@ -19,6 +18,7 @@ from zhenxun.models.group_member_info import GroupInfoUser
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.depends import UserName
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="昵称系统",
|
||||
@@ -124,27 +124,37 @@ def CheckNickname():
|
||||
(name,) = reg_group
|
||||
logger.debug(f"昵称检查: {name}", "昵称设置", session=session)
|
||||
if not name:
|
||||
await Text("叫你空白?叫你虚空?叫你无名??").finish(at_sender=True)
|
||||
await MessageUtils.build_message("叫你空白?叫你虚空?叫你无名??").finish(
|
||||
at_sender=True
|
||||
)
|
||||
if session.id1 in bot.config.superusers:
|
||||
logger.debug(
|
||||
f"超级用户设置昵称, 跳过合法检测: {name}", "昵称设置", session=session
|
||||
)
|
||||
return
|
||||
if len(name) > 20:
|
||||
await Text("昵称可不能超过20个字!").finish(at_sender=True)
|
||||
await MessageUtils.build_message("昵称可不能超过20个字!").finish(
|
||||
at_sender=True
|
||||
)
|
||||
if name in bot.config.nickname:
|
||||
await Text("笨蛋!休想占用我的名字! #").finish(at_sender=True)
|
||||
await MessageUtils.build_message("笨蛋!休想占用我的名字! #").finish(
|
||||
at_sender=True
|
||||
)
|
||||
if black_word:
|
||||
for x in name:
|
||||
if x in black_word:
|
||||
logger.debug("昵称设置禁止字符: [{x}]", "昵称设置", session=session)
|
||||
await Text(f"字符 [{x}] 为禁止字符!").finish(at_sender=True)
|
||||
await MessageUtils.build_message(f"字符 [{x}] 为禁止字符!").finish(
|
||||
at_sender=True
|
||||
)
|
||||
for word in black_word:
|
||||
if word in name:
|
||||
logger.debug(
|
||||
"昵称设置禁止字符: [{word}]", "昵称设置", session=session
|
||||
)
|
||||
await Text(f"字符 [{x}] 为禁止字符!").finish(at_sender=True)
|
||||
await MessageUtils.build_message(f"字符 [{x}] 为禁止字符!").finish(
|
||||
at_sender=True
|
||||
)
|
||||
|
||||
return Depends(dependency)
|
||||
|
||||
@@ -171,7 +181,9 @@ async def _(
|
||||
session.platform,
|
||||
)
|
||||
logger.info(f"设置群昵称成功: {name}", "昵称设置", session=session)
|
||||
await Text(random.choice(CALL_NAME).format(name)).finish(reply=True)
|
||||
await MessageUtils.build_message(
|
||||
random.choice(CALL_NAME).format(name)
|
||||
).finish(reply_to=True)
|
||||
else:
|
||||
await FriendUser.set_user_nickname(
|
||||
session.id1,
|
||||
@@ -182,8 +194,10 @@ async def _(
|
||||
session.platform,
|
||||
)
|
||||
logger.info(f"设置私聊昵称成功: {name}", "昵称设置", session=session)
|
||||
await Text(random.choice(CALL_NAME).format(name)).finish(reply=True)
|
||||
await Text("用户id为空...").send()
|
||||
await MessageUtils.build_message(
|
||||
random.choice(CALL_NAME).format(name)
|
||||
).finish(reply_to=True)
|
||||
await MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
|
||||
@_global_nickname_matcher.handle(parameterless=[CheckNickname()])
|
||||
@@ -202,8 +216,10 @@ async def _(
|
||||
)
|
||||
await GroupInfoUser.filter(user_id=session.id1).update(nickname=name)
|
||||
logger.info(f"设置全局昵称成功: {name}", "设置全局昵称", session=session)
|
||||
await Text(random.choice(CALL_NAME).format(name)).finish(reply=True)
|
||||
await Text("用户id为空...").send()
|
||||
await MessageUtils.build_message(random.choice(CALL_NAME).format(name)).finish(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
|
||||
@_matcher.assign("name")
|
||||
@@ -216,9 +232,11 @@ async def _(session: EventSession, user_info: UserInfo = EventUserInfo()):
|
||||
nickname = await FriendUser.get_user_nickname(session.id1)
|
||||
card = user_info.user_name
|
||||
if nickname:
|
||||
await Text(random.choice(REMIND).format(nickname)).finish(reply=True)
|
||||
await MessageUtils.build_message(
|
||||
random.choice(REMIND).format(nickname)
|
||||
).finish(reply_to=True)
|
||||
else:
|
||||
await Text(
|
||||
await MessageUtils.build_message(
|
||||
random.choice(
|
||||
[
|
||||
"没..没有昵称嘛,{}",
|
||||
@@ -227,8 +245,8 @@ async def _(session: EventSession, user_info: UserInfo = EventUserInfo()):
|
||||
"你是{}?",
|
||||
]
|
||||
).format(card)
|
||||
).finish(reply=True)
|
||||
await Text("用户id为空...").send()
|
||||
).finish(reply_to=True)
|
||||
await MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
|
||||
@_matcher.assign("cancel")
|
||||
@@ -240,7 +258,9 @@ async def _(bot: Bot, session: EventSession, user_info: UserInfo = EventUserInfo
|
||||
else:
|
||||
nickname = await FriendUser.get_user_nickname(session.id1)
|
||||
if nickname:
|
||||
await Text(random.choice(CANCEL).format(nickname)).send(reply=True)
|
||||
await MessageUtils.build_message(
|
||||
random.choice(CANCEL).format(nickname)
|
||||
).send(reply_to=True)
|
||||
if gid:
|
||||
await GroupInfoUser.set_user_nickname(session.id1, gid, "")
|
||||
else:
|
||||
@@ -248,5 +268,7 @@ async def _(bot: Bot, session: EventSession, user_info: UserInfo = EventUserInfo
|
||||
await BanConsole.ban(session.id1, gid, 9, 60, bot.self_id)
|
||||
return
|
||||
else:
|
||||
await Text("你在做梦吗?你没有昵称啊").finish(reply=True)
|
||||
await Text("用户id为空...").send()
|
||||
await MessageUtils.build_message("你在做梦吗?你没有昵称啊").finish(
|
||||
reply_to=True
|
||||
)
|
||||
await MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
@@ -16,7 +16,7 @@ from nonebot.adapters.onebot.v12 import (
|
||||
GroupMemberIncreaseEvent,
|
||||
)
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot_plugin_saa import Image, Mention, MessageFactory, Text
|
||||
from nonebot_plugin_alconna import At
|
||||
|
||||
from zhenxun.configs.config import NICKNAME, Config
|
||||
from zhenxun.configs.path_config import DATA_PATH, IMAGE_PATH
|
||||
@@ -29,6 +29,7 @@ from zhenxun.models.plugin_info import PluginInfo
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType, RequestHandleType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.utils import FreqLimiter
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
@@ -235,26 +236,26 @@ async def _(bot: Bot, event: GroupIncreaseNoticeEvent | GroupMemberIncreaseEvent
|
||||
msg_split = re.split(r"\[image:\d+\]", message)
|
||||
msg_list = []
|
||||
if data["at"]:
|
||||
msg_list.append(Mention(user_id))
|
||||
msg_list.append(At(flag="user", target=user_id))
|
||||
for i, text in enumerate(msg_split):
|
||||
msg_list.append(Text(text))
|
||||
msg_list.append(text)
|
||||
img_file = path / f"{i}.png"
|
||||
if img_file.exists():
|
||||
msg_list.append(Image(img_file))
|
||||
msg_list.append(img_file)
|
||||
if not TaskInfo.is_block("group_welcome", group_id):
|
||||
logger.info(f"发送群欢迎消息...", "入群检测", group_id=group_id)
|
||||
if msg_list:
|
||||
await MessageFactory(msg_list).send()
|
||||
await MessageUtils.build_message(msg_list).send()
|
||||
else:
|
||||
image = (
|
||||
IMAGE_PATH
|
||||
/ "qxz"
|
||||
/ random.choice(os.listdir(IMAGE_PATH / "qxz"))
|
||||
)
|
||||
await MessageFactory(
|
||||
await MessageUtils.build_message(
|
||||
[
|
||||
Text("新人快跑啊!!本群现状↓(快使用自定义!)"),
|
||||
Image(image),
|
||||
"新人快跑啊!!本群现状↓(快使用自定义!)",
|
||||
image,
|
||||
]
|
||||
).send()
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import nonebot
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot_plugin_apscheduler import scheduler
|
||||
from nonebot_plugin_saa import Image
|
||||
|
||||
from zhenxun.configs.config import NICKNAME
|
||||
from zhenxun.configs.path_config import IMAGE_PATH
|
||||
@@ -9,6 +8,7 @@ from zhenxun.configs.utils import PluginExtraData, Task
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.platform import broadcast_group
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
@@ -50,21 +50,23 @@ async def check(group_id: str) -> bool:
|
||||
minute=1,
|
||||
)
|
||||
async def _():
|
||||
img = Image(IMAGE_PATH / "zhenxun" / "zao.jpg")
|
||||
await broadcast_group("早上好" + img, log_cmd="被动早晚安", check_func=check)
|
||||
message = MessageUtils.build_message(["早上好", IMAGE_PATH / "zhenxun" / "zao.jpg"])
|
||||
await broadcast_group(message, log_cmd="被动早晚安", check_func=check)
|
||||
logger.info("每日早安发送...")
|
||||
|
||||
|
||||
# # 睡觉了
|
||||
@scheduler.scheduled_job(
|
||||
"cron",
|
||||
hour=23,
|
||||
minute=59,
|
||||
hour=1,
|
||||
minute=16,
|
||||
)
|
||||
async def _():
|
||||
img = Image(IMAGE_PATH / "zhenxun" / "sleep.jpg")
|
||||
message = MessageUtils.build_message(
|
||||
[f"{NICKNAME}要睡觉了,你们也要早点睡呀", IMAGE_PATH / "zhenxun" / "sleep.jpg"]
|
||||
)
|
||||
await broadcast_group(
|
||||
f"{NICKNAME}要睡觉了,你们也要早点睡呀" + img,
|
||||
message,
|
||||
log_cmd="被动早晚安",
|
||||
check_func=check,
|
||||
)
|
||||
|
||||
@@ -5,16 +5,17 @@ from nonebot_plugin_alconna import (
|
||||
Args,
|
||||
Arparma,
|
||||
Subcommand,
|
||||
UniMessage,
|
||||
UniMsg,
|
||||
on_alconna,
|
||||
)
|
||||
from nonebot_plugin_saa import Image, MessageFactory, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
from nonebot_plugin_userinfo import EventUserInfo, UserInfo
|
||||
|
||||
from zhenxun.configs.utils import BaseBlock, PluginExtraData
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import BlockType, PluginType
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
from ._data_source import ShopManage
|
||||
|
||||
@@ -84,7 +85,7 @@ _matcher.shortcut(
|
||||
async def _(session: EventSession, arparma: Arparma):
|
||||
image = await ShopManage.build_shop_image()
|
||||
logger.info("查看商店", arparma.header_result, session=session)
|
||||
await Image(image.pic2bytes()).send()
|
||||
await MessageUtils.build_message(image).send()
|
||||
|
||||
|
||||
@_matcher.assign("my-cost")
|
||||
@@ -92,9 +93,9 @@ async def _(session: EventSession, arparma: Arparma):
|
||||
if session.id1:
|
||||
logger.info("查看金币", arparma.header_result, session=session)
|
||||
gold = await ShopManage.my_cost(session.id1, session.platform)
|
||||
await Text(f"你的当前余额: {gold}").send(reply=True)
|
||||
await MessageUtils.build_message(f"你的当前余额: {gold}").send(reply_to=True)
|
||||
else:
|
||||
await Text(f"用户id为空...").send(reply=True)
|
||||
await MessageUtils.build_message(f"用户id为空...").send(reply_to=True)
|
||||
|
||||
|
||||
@_matcher.assign("my-props")
|
||||
@@ -108,10 +109,12 @@ async def _(
|
||||
user_info.user_displayname or user_info.user_name,
|
||||
session.platform,
|
||||
):
|
||||
await Image(image.pic2bytes()).finish(reply=True)
|
||||
return await Text(f"你的道具为空捏...").send(reply=True)
|
||||
await MessageUtils.build_message(image.pic2bytes()).finish(reply_to=True)
|
||||
return await MessageUtils.build_message(f"你的道具为空捏...").send(
|
||||
reply_to=True
|
||||
)
|
||||
else:
|
||||
await Text(f"用户id为空...").send(reply=True)
|
||||
await MessageUtils.build_message(f"用户id为空...").send(reply_to=True)
|
||||
|
||||
|
||||
@_matcher.assign("buy")
|
||||
@@ -123,9 +126,9 @@ async def _(session: EventSession, arparma: Arparma, name: str, num: int):
|
||||
session=session,
|
||||
)
|
||||
result = await ShopManage.buy_prop(session.id1, name, num, session.platform)
|
||||
await Text(result).send(reply=True)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
else:
|
||||
await Text(f"用户id为空...").send(reply=True)
|
||||
await MessageUtils.build_message(f"用户id为空...").send(reply_to=True)
|
||||
|
||||
|
||||
@_matcher.assign("use")
|
||||
@@ -141,6 +144,6 @@ async def _(
|
||||
result = await ShopManage.use(bot, event, session, message, name, num, "")
|
||||
logger.info(f"使用道具 {name}, 数量: {num}", arparma.header_result, session=session)
|
||||
if isinstance(result, str):
|
||||
await Text(result).send(reply=True)
|
||||
elif isinstance(result, MessageFactory):
|
||||
await result.finish(reply=True)
|
||||
await MessageUtils.build_message(result).send(reply_to=True)
|
||||
elif isinstance(result, UniMessage):
|
||||
await result.finish(reply_to=True)
|
||||
|
||||
@@ -5,7 +5,7 @@ from types import MappingProxyType
|
||||
from typing import Any, Callable, Literal
|
||||
|
||||
from nonebot.adapters import Bot, Event
|
||||
from nonebot_plugin_alconna import UniMsg
|
||||
from nonebot_plugin_alconna import UniMessage, UniMsg
|
||||
from nonebot_plugin_saa import MessageFactory
|
||||
from nonebot_plugin_session import EventSession
|
||||
from pydantic import BaseModel, create_model
|
||||
@@ -190,7 +190,7 @@ class ShopManage:
|
||||
session: EventSession,
|
||||
message: UniMsg,
|
||||
**kwargs,
|
||||
) -> str | MessageFactory | None:
|
||||
) -> str | UniMessage | None:
|
||||
"""运行道具函数
|
||||
|
||||
参数:
|
||||
@@ -229,7 +229,7 @@ class ShopManage:
|
||||
goods_name: str,
|
||||
num: int,
|
||||
text: str,
|
||||
) -> str | MessageFactory | None:
|
||||
) -> str | UniMessage | None:
|
||||
"""使用道具
|
||||
|
||||
参数:
|
||||
|
||||
@@ -8,12 +8,12 @@ from nonebot_plugin_alconna import (
|
||||
store_true,
|
||||
)
|
||||
from nonebot_plugin_apscheduler import scheduler
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.utils import PluginCdBlock, PluginExtraData, RegisterConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.depends import UserName
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
from ._data_source import SignManage
|
||||
from .goods_register import driver
|
||||
@@ -121,8 +121,8 @@ async def _(session: EventSession, arparma: Arparma, nickname: str = UserName())
|
||||
if session.id1:
|
||||
if path := await SignManage.sign(session, nickname):
|
||||
logger.info("签到成功", arparma.header_result, session=session)
|
||||
await Image(path).finish()
|
||||
return Text("用户id为空...").send()
|
||||
await MessageUtils.build_message(path).finish()
|
||||
return MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
|
||||
@_sign_matcher.assign("my")
|
||||
@@ -130,22 +130,24 @@ async def _(session: EventSession, arparma: Arparma, nickname: str = UserName())
|
||||
if session.id1:
|
||||
if image := await SignManage.sign(session, nickname, True):
|
||||
logger.info("查看我的签到", arparma.header_result, session=session)
|
||||
await Image(image).finish()
|
||||
return Text("用户id为空...").send()
|
||||
await MessageUtils.build_message(image).finish()
|
||||
return MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
|
||||
@_sign_matcher.assign("list")
|
||||
async def _(session: EventSession, arparma: Arparma, num: int):
|
||||
gid = session.id3 or session.id2
|
||||
if not arparma.find("global") and not gid:
|
||||
await Text("私聊中无法查看 '好感度排行',请发送 '好感度总排行'").finish()
|
||||
await MessageUtils.build_message(
|
||||
"私聊中无法查看 '好感度排行',请发送 '好感度总排行'"
|
||||
).finish()
|
||||
if session.id1:
|
||||
if arparma.find("global"):
|
||||
gid = None
|
||||
if image := await SignManage.rank(session.id1, num, gid):
|
||||
logger.info("查看签到排行", arparma.header_result, session=session)
|
||||
await Image(image.pic2bytes()).finish()
|
||||
return Text("用户id为空...").send()
|
||||
await MessageUtils.build_message(image).finish()
|
||||
return MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
|
||||
@scheduler.scheduled_job(
|
||||
|
||||
@@ -3,7 +3,6 @@ from nonebot.permission import SUPERUSER
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot.rule import to_me
|
||||
from nonebot_plugin_alconna import UniMsg
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
from tortoise import Tortoise
|
||||
|
||||
@@ -12,6 +11,7 @@ from zhenxun.services.db_context import TestSQL
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.image_utils import ImageTemplate
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="数据库操作",
|
||||
@@ -56,7 +56,7 @@ async def _(session: EventSession, message: UniMsg):
|
||||
if sql_text.startswith("exec"):
|
||||
sql_text = sql_text[4:].strip()
|
||||
if not sql_text:
|
||||
await Text("需要执行的的SQL语句!").finish()
|
||||
await MessageUtils.build_message("需要执行的的SQL语句!").finish()
|
||||
logger.info(f"执行SQL语句: {sql_text}", "exec", session=session)
|
||||
try:
|
||||
if not sql_text.lower().startswith("select"):
|
||||
@@ -77,11 +77,11 @@ async def _(session: EventSession, message: UniMsg):
|
||||
table = await ImageTemplate.table_page(
|
||||
"EXEC", f"总共有 {len(data_list)} 条数据捏", list(_column), data_list
|
||||
)
|
||||
await Image(table.pic2bytes()).send()
|
||||
await MessageUtils.build_message(table).send()
|
||||
except Exception as e:
|
||||
logger.error("执行 SQL 语句失败...", session=session, e=e)
|
||||
await Text(f"执行 SQL 语句失败... {type(e)}").finish()
|
||||
await Text("执行 SQL 语句成功!").finish()
|
||||
await MessageUtils.build_message(f"执行 SQL 语句失败... {type(e)}").finish()
|
||||
await MessageUtils.build_message("执行 SQL 语句成功!").finish()
|
||||
|
||||
|
||||
@_table_matcher.handle()
|
||||
@@ -97,7 +97,7 @@ async def _(session: EventSession):
|
||||
table = await ImageTemplate.table_page(
|
||||
"数据库表", f"总共有 {len(data_list)} 张表捏", column_name, data_list
|
||||
)
|
||||
await Image(table.pic2bytes()).send()
|
||||
await MessageUtils.build_message(table).send()
|
||||
except Exception as e:
|
||||
logger.error("获取表数据失败...", session=session, e=e)
|
||||
await Text(f"获取表数据失败... {type(e)}").send()
|
||||
await MessageUtils.build_message(f"获取表数据失败... {type(e)}").send()
|
||||
|
||||
@@ -14,7 +14,6 @@ from nonebot_plugin_alconna import (
|
||||
on_alconna,
|
||||
store_true,
|
||||
)
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.path_config import IMAGE_PATH
|
||||
@@ -24,6 +23,7 @@ from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType, RequestHandleType, RequestType
|
||||
from zhenxun.utils.exception import NotFoundError
|
||||
from zhenxun.utils.image_utils import BuildImage
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.utils import get_user_avatar
|
||||
|
||||
usage = """
|
||||
@@ -143,11 +143,13 @@ async def _(
|
||||
if handle_type == RequestHandleType.IGNORE:
|
||||
await FgRequest.ignore(id)
|
||||
except NotFoundError:
|
||||
await Text("未发现此id的请求...").finish(reply=True)
|
||||
await MessageUtils.build_message("未发现此id的请求...").finish(reply_to=True)
|
||||
except Exception:
|
||||
await Text("其他错误, 可能flag已失效...").finish(reply=True)
|
||||
await MessageUtils.build_message("其他错误, 可能flag已失效...").finish(
|
||||
reply_to=True
|
||||
)
|
||||
logger.info("处理请求", arparma.header_result, session=session)
|
||||
await Text("成功处理请求!").finish(reply=True)
|
||||
await MessageUtils.build_message("成功处理请求!").finish(reply_to=True)
|
||||
|
||||
|
||||
@_read_matcher.handle()
|
||||
@@ -232,9 +234,9 @@ async def _(
|
||||
await result_image.text((15, 13), _type_text, fill=(140, 140, 143))
|
||||
req_image_list.append(result_image)
|
||||
if not req_image_list:
|
||||
await Text("没有任何请求喔...").finish(reply=True)
|
||||
await MessageUtils.build_message("没有任何请求喔...").finish(reply_to=True)
|
||||
if len(req_image_list) == 1:
|
||||
await Image(req_image_list[0].pic2bytes()).finish()
|
||||
await MessageUtils.build_message(req_image_list[0]).finish()
|
||||
width = sum([img.width for img in req_image_list])
|
||||
height = max([img.height for img in req_image_list])
|
||||
background = BuildImage(width, height)
|
||||
@@ -242,8 +244,8 @@ async def _(
|
||||
await req_image_list[1].line((0, 10, 1, req_image_list[1].height - 10), width=1)
|
||||
await background.paste(req_image_list[1], (req_image_list[1].width, 0))
|
||||
logger.info("查看请求", arparma.header_result, session=session)
|
||||
await Image(background.pic2bytes()).finish()
|
||||
await Text("没有任何请求喔...").finish(reply=True)
|
||||
await MessageUtils.build_message(background).finish()
|
||||
await MessageUtils.build_message("没有任何请求喔...").finish(reply_to=True)
|
||||
|
||||
|
||||
@_clear_matcher.handle()
|
||||
@@ -270,4 +272,4 @@ async def _(
|
||||
handle_type=RequestHandleType.IGNORE
|
||||
)
|
||||
logger.info(f"清空{_type}请求", arparma.header_result, session=session)
|
||||
await Text(f"已清空{_type}请求!").finish()
|
||||
await MessageUtils.build_message(f"已清空{_type}请求!").finish()
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import nonebot
|
||||
from arclet.alconna import Args, Option
|
||||
from nonebot.permission import SUPERUSER
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from nonebot_plugin_alconna import Alconna, Arparma, on_alconna
|
||||
from nonebot_plugin_alconna.matcher import AlconnaMatcher
|
||||
from nonebot_plugin_saa import Image, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.config import Config
|
||||
from zhenxun.configs.path_config import DATA_PATH, IMAGE_PATH
|
||||
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
|
||||
from zhenxun.configs.path_config import IMAGE_PATH
|
||||
from zhenxun.configs.utils import PluginExtraData
|
||||
from zhenxun.models.plugin_info import PluginInfo
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.log import logger
|
||||
@@ -21,6 +18,7 @@ from zhenxun.utils.image_utils import (
|
||||
group_image,
|
||||
text2image,
|
||||
)
|
||||
from zhenxun.utils.message import MessageUtils
|
||||
from zhenxun.utils.rules import admin_check, ensure_group
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
@@ -156,6 +154,6 @@ async def _(
|
||||
try:
|
||||
await build_help()
|
||||
except EmptyError:
|
||||
await Text("超级用户帮助为空").finish(reply=True)
|
||||
await Image(SUPERUSER_HELP_IMAGE).send()
|
||||
await MessageUtils.build_message("超级用户帮助为空").finish(reply_to=True)
|
||||
await MessageUtils.build_message(SUPERUSER_HELP_IMAGE).send()
|
||||
logger.info("查看超级用户帮助", arparma.header_result, session=session)
|
||||
|
||||
Reference in New Issue
Block a user