🐛 修改禁用module (#1688)

* 🐛 修改禁用module

* chore(version): Update version to v0.2.3-4cde662

---------

Co-authored-by: HibiKier <HibiKier@users.noreply.github.com>
This commit is contained in:
HibiKier 2024-10-09 17:45:53 +08:00 committed by GitHub
parent 5f92efa658
commit 2f459719e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 13 deletions

View File

@ -1 +1 @@
__version__: v0.2.3-ba3a9f1
__version__: v0.2.3-4cde662

View File

@ -53,6 +53,7 @@ async def _():
_group, _ = await GroupConsole.get_or_create(
group_id=group.group_id, channel_id__isnull=True
)
modules = [f"<{module}" for module in modules]
_group.block_task = ",".join(modules) + "," # type: ignore
update_list.append(_group)
logger.info(

View File

@ -71,19 +71,19 @@ async def _():
for group in await GroupConsole.all():
if group.block_plugin:
if modules := group.block_plugin.split(","):
if block_plugin := [
f"<{module}" for module in modules if not module.startswith("<")
]:
group.block_plugin = (",".join(block_plugin) + ",").replace(
"<,", ""
)
block_plugin = "".join(
(f"{module}," if module.startswith("<") else f"<{module},")
for module in modules
if module.strip()
)
group.block_plugin = block_plugin.replace("<,", "")
if group.block_task:
if modules := group.block_task.split(","):
if block_task := [
f"<{module}" for module in modules if not module.startswith("<")
]:
group.block_task = (",".join(block_task) + ",").replace(
"<,", ""
)
block_task = "".join(
(f"{module}," if module.startswith("<") else f"<{module},")
for module in modules
if module.strip()
)
group.block_task = block_task.replace("<,", "")
data_list.append(group)
await GroupConsole.bulk_update(data_list, ["block_plugin", "block_task"], 10)