🐛 修复群聊启用在带参数不正确的问题

This commit is contained in:
远野千束 2024-04-28 18:52:22 +08:00
parent d43fe327c2
commit c063c69dea

View File

@ -383,6 +383,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
)
await md.send_md(reply, bot, event=event)
@on_alconna(
aliases={"群聊"},
command=Alconna(
@ -403,18 +404,18 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
async def _(bot: T_Bot, event: T_MessageEvent, gm: Matcher, result: Arparma):
ulang = get_user_lang(str(event.user_id))
to_enable = result.subcommands.get(enable) is not None
group_id = None
if await SUPERUSER(bot, event):
# 仅超级用户可以自定义群号
group_id = result.subcommands.get(enable, result.subcommands.get(disable)).args.get("group_id")
if group_id is None and event.message_type == "group":
group_id = str(event.group_id)
else:
if group_id is None:
await gm.finish(ulang.get("liteyuki.invalid_command"), liteyuki_pass=True)
enabled = get_group_enable(group_id)
print(enabled, to_enable)
if enabled == to_enable:
await gm.finish(ulang.get("liteyuki.group_already", STATUS=ulang.get("npm.enable") if to_enable else ulang.get("npm.disable"), GROUP=group_id),
liteyuki_pass=True)