From 91dce56bf8ff9db7e1e169d81a2caf63e337e928 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Mon, 30 Dec 2024 16:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E7=BE=A4?= =?UTF-8?q?=E7=BB=84=E4=B8=AD=E6=8F=92=E4=BB=B6=E9=BB=98=E8=AE=A4=E7=8A=B6?= =?UTF-8?q?=E6=80=81=20(#1810)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/plugin_switch/command.py | 8 +-- zhenxun/models/group_console.py | 68 ++++++++++++++++--- 2 files changed, 62 insertions(+), 14 deletions(-) diff --git a/zhenxun/builtin_plugins/admin/plugin_switch/command.py b/zhenxun/builtin_plugins/admin/plugin_switch/command.py index 6d33b4df..8c3e8fab 100644 --- a/zhenxun/builtin_plugins/admin/plugin_switch/command.py +++ b/zhenxun/builtin_plugins/admin/plugin_switch/command.py @@ -133,16 +133,16 @@ _status_matcher.shortcut( ) _status_matcher.shortcut( - r"关闭(?P.+)", + r"关闭(插件|功能)df(?P.+)", command="switch", - arguments=["close", "{name}"], + arguments=["close", "{name}", "-df"], prefix=True, ) _status_matcher.shortcut( - r"关闭(插件|功能)df(?P.+)", + r"关闭(?P.+)", command="switch", - arguments=["close", "{name}", "-df"], + arguments=["close", "{name}"], prefix=True, ) diff --git a/zhenxun/models/group_console.py b/zhenxun/models/group_console.py index 25e539ea..8520b93d 100644 --- a/zhenxun/models/group_console.py +++ b/zhenxun/models/group_console.py @@ -1,11 +1,13 @@ -from typing import Any +from typing import Any, overload from typing_extensions import Self from tortoise import fields from tortoise.backends.base.client import BaseDBAsyncClient +from zhenxun.models.plugin_info import PluginInfo from zhenxun.models.task_info import TaskInfo from zhenxun.services.db_context import Model +from zhenxun.utils.enum import PluginType class GroupConsole(Model): @@ -49,6 +51,34 @@ class GroupConsole(Model): table_description = "群组信息表" unique_together = ("group_id", "channel_id") + @staticmethod + def format(name: str) -> str: + return f"<{name}," + + @overload + @classmethod + def convert_module_format(cls, data: str) -> list[str]: ... + + @overload + @classmethod + def convert_module_format(cls, data: list[str]) -> str: ... + + @classmethod + def convert_module_format(cls, data: str | list[str]) -> str | list[str]: + """ + 在 `