mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 21:52:56 +08:00
🔧 移除帮助图片删除功能,简化插件切换逻辑。更新相关导入,优化代码结构。 (#2027)
Some checks are pending
检查bot是否运行正常 / bot check (push) Waiting to run
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Sequential Lint and Type Check / ruff-call (push) Waiting to run
Sequential Lint and Type Check / pyright-call (push) Blocked by required conditions
Release Drafter / Update Release Draft (push) Waiting to run
Force Sync to Aliyun / sync (push) Waiting to run
Update Version / update-version (push) Waiting to run
Some checks are pending
检查bot是否运行正常 / bot check (push) Waiting to run
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Sequential Lint and Type Check / ruff-call (push) Waiting to run
Sequential Lint and Type Check / pyright-call (push) Blocked by required conditions
Release Drafter / Update Release Draft (push) Waiting to run
Force Sync to Aliyun / sync (push) Waiting to run
Update Version / update-version (push) Waiting to run
This commit is contained in:
parent
f9a38a26b2
commit
095a123c3c
@ -9,7 +9,7 @@ from zhenxun.services.log import logger
|
|||||||
from zhenxun.utils.enum import BlockType, PluginType
|
from zhenxun.utils.enum import BlockType, PluginType
|
||||||
from zhenxun.utils.message import MessageUtils
|
from zhenxun.utils.message import MessageUtils
|
||||||
|
|
||||||
from ._data_source import PluginManager, build_plugin, build_task, delete_help_image
|
from ._data_source import PluginManager, build_plugin, build_task
|
||||||
from .command import _group_status_matcher, _status_matcher
|
from .command import _group_status_matcher, _status_matcher
|
||||||
|
|
||||||
base_config = Config.get("plugin_switch")
|
base_config = Config.get("plugin_switch")
|
||||||
@ -154,7 +154,6 @@ async def _(
|
|||||||
else:
|
else:
|
||||||
result = await PluginManager.unblock_group_plugin(name, group_id)
|
result = await PluginManager.unblock_group_plugin(name, group_id)
|
||||||
logger.info(f"开启功能 {name}", arparma.header_result, session=session)
|
logger.info(f"开启功能 {name}", arparma.header_result, session=session)
|
||||||
delete_help_image(group_id)
|
|
||||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||||
elif session.user.id in bot.config.superusers:
|
elif session.user.id in bot.config.superusers:
|
||||||
"""私聊"""
|
"""私聊"""
|
||||||
@ -218,7 +217,6 @@ async def _(
|
|||||||
session=session,
|
session=session,
|
||||||
target=group_id,
|
target=group_id,
|
||||||
)
|
)
|
||||||
delete_help_image()
|
|
||||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||||
|
|
||||||
|
|
||||||
@ -266,7 +264,6 @@ async def _(
|
|||||||
else:
|
else:
|
||||||
result = await PluginManager.block_group_plugin(name, group_id)
|
result = await PluginManager.block_group_plugin(name, group_id)
|
||||||
logger.info(f"关闭功能 {name}", arparma.header_result, session=session)
|
logger.info(f"关闭功能 {name}", arparma.header_result, session=session)
|
||||||
delete_help_image(group_id)
|
|
||||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||||
elif session.user.id in bot.config.superusers:
|
elif session.user.id in bot.config.superusers:
|
||||||
group_id = group.result if group.available else None
|
group_id = group.result if group.available else None
|
||||||
@ -338,7 +335,6 @@ async def _(
|
|||||||
session=session,
|
session=session,
|
||||||
target=group_id,
|
target=group_id,
|
||||||
)
|
)
|
||||||
delete_help_image()
|
|
||||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import os
|
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
from zhenxun.configs.path_config import DATA_PATH, IMAGE_PATH
|
|
||||||
from zhenxun.models.group_console import GroupConsole
|
from zhenxun.models.group_console import GroupConsole
|
||||||
from zhenxun.models.plugin_info import PluginInfo
|
from zhenxun.models.plugin_info import PluginInfo
|
||||||
from zhenxun.models.task_info import TaskInfo
|
from zhenxun.models.task_info import TaskInfo
|
||||||
@ -11,23 +9,6 @@ from zhenxun.utils.enum import BlockType, CacheType, PluginType
|
|||||||
from zhenxun.utils.exception import GroupInfoNotFound
|
from zhenxun.utils.exception import GroupInfoNotFound
|
||||||
from zhenxun.utils.image_utils import BuildImage, ImageTemplate, RowStyle
|
from zhenxun.utils.image_utils import BuildImage, ImageTemplate, RowStyle
|
||||||
|
|
||||||
HELP_FILE = IMAGE_PATH / "SIMPLE_HELP.png"
|
|
||||||
|
|
||||||
GROUP_HELP_PATH = DATA_PATH / "group_help"
|
|
||||||
|
|
||||||
|
|
||||||
def delete_help_image(gid: str | None = None):
|
|
||||||
"""删除帮助图片"""
|
|
||||||
if gid:
|
|
||||||
for file in os.listdir(GROUP_HELP_PATH):
|
|
||||||
if file.startswith(f"{gid}"):
|
|
||||||
os.remove(GROUP_HELP_PATH / file)
|
|
||||||
else:
|
|
||||||
if HELP_FILE.exists():
|
|
||||||
HELP_FILE.unlink()
|
|
||||||
for file in GROUP_HELP_PATH.iterdir():
|
|
||||||
file.unlink()
|
|
||||||
|
|
||||||
|
|
||||||
def plugin_row_style(column: str, text: str) -> RowStyle:
|
def plugin_row_style(column: str, text: str) -> RowStyle:
|
||||||
"""被动技能文本风格
|
"""被动技能文本风格
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user