2024-10-05 16:45:02 +08:00
|
|
|
from zhenxun.models.group_console import GroupConsole
|
2025-06-16 09:11:41 +08:00
|
|
|
from zhenxun.utils.manager.priority_manager import PriorityLifecycle
|
2024-02-25 03:18:34 +08:00
|
|
|
|
|
|
|
|
|
2025-06-16 09:11:41 +08:00
|
|
|
@PriorityLifecycle.on_startup(priority=5)
|
2024-10-05 16:45:02 +08:00
|
|
|
async def _():
|
|
|
|
|
"""开启/禁用插件格式修改"""
|
|
|
|
|
_, is_create = await GroupConsole.get_or_create(group_id=133133133)
|
|
|
|
|
"""标记"""
|
|
|
|
|
if is_create:
|
|
|
|
|
data_list = []
|
|
|
|
|
for group in await GroupConsole.all():
|
|
|
|
|
if group.block_plugin:
|
2024-10-05 18:02:53 +08:00
|
|
|
if modules := group.block_plugin.split(","):
|
2024-10-09 17:45:53 +08:00
|
|
|
block_plugin = "".join(
|
|
|
|
|
(f"{module}," if module.startswith("<") else f"<{module},")
|
|
|
|
|
for module in modules
|
|
|
|
|
if module.strip()
|
|
|
|
|
)
|
|
|
|
|
group.block_plugin = block_plugin.replace("<,", "")
|
2024-10-05 16:45:02 +08:00
|
|
|
if group.block_task:
|
2024-10-05 18:02:53 +08:00
|
|
|
if modules := group.block_task.split(","):
|
2024-10-09 17:45:53 +08:00
|
|
|
block_task = "".join(
|
|
|
|
|
(f"{module}," if module.startswith("<") else f"<{module},")
|
|
|
|
|
for module in modules
|
|
|
|
|
if module.strip()
|
|
|
|
|
)
|
|
|
|
|
group.block_task = block_task.replace("<,", "")
|
2024-10-05 16:45:02 +08:00
|
|
|
data_list.append(group)
|
|
|
|
|
await GroupConsole.bulk_update(data_list, ["block_plugin", "block_task"], 10)
|