mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-04 11:20:01 +08:00
🐛 修复获取群组时会修改群组插件关闭状态 (#1869)
* 🐛 修复获取群组时会修改群组插件关闭状态 * ✨ 支持https图片地址转换 * ✨ 支持https图片地址转换 * 🎨 移除多余导入 * 🎨 优化GroupConsole设置插件默认状态代码结构 * 🎨 优化群组表代码结构 * ⚡ 移除build_message的https默认转图片
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from zhenxun.configs.path_config import DATA_PATH, IMAGE_PATH
|
||||
from zhenxun.models.group_console import GroupConsole
|
||||
from zhenxun.models.plugin_info import PluginInfo
|
||||
@@ -14,9 +16,9 @@ GROUP_HELP_PATH = DATA_PATH / "group_help"
|
||||
def delete_help_image(gid: str | None = None):
|
||||
"""删除帮助图片"""
|
||||
if gid:
|
||||
file = GROUP_HELP_PATH / f"{gid}.png"
|
||||
if file.exists():
|
||||
file.unlink()
|
||||
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()
|
||||
@@ -196,7 +198,7 @@ class PluginManage:
|
||||
await PluginInfo.filter(plugin_type=PluginType.NORMAL).update(
|
||||
default_status=status
|
||||
)
|
||||
return f'成功将所有功能进群默认状态修改为: {"开启" if status else "关闭"}'
|
||||
return f"成功将所有功能进群默认状态修改为: {'开启' if status else '关闭'}"
|
||||
if group_id:
|
||||
if group := await GroupConsole.get_or_none(
|
||||
group_id=group_id, channel_id__isnull=True
|
||||
@@ -213,12 +215,12 @@ class PluginManage:
|
||||
module_list = [f"<{module}" for module in module_list]
|
||||
group.block_plugin = ",".join(module_list) + "," # type: ignore
|
||||
await group.save(update_fields=["block_plugin"])
|
||||
return f'成功将此群组所有功能状态修改为: {"开启" if status else "关闭"}'
|
||||
return f"成功将此群组所有功能状态修改为: {'开启' if status else '关闭'}"
|
||||
return "获取群组失败..."
|
||||
await PluginInfo.filter(plugin_type=PluginType.NORMAL).update(
|
||||
status=status, block_type=None if status else BlockType.ALL
|
||||
)
|
||||
return f'成功将所有功能全局状态修改为: {"开启" if status else "关闭"}'
|
||||
return f"成功将所有功能全局状态修改为: {'开启' if status else '关闭'}"
|
||||
|
||||
@classmethod
|
||||
async def is_wake(cls, group_id: str) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user