mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-14 11:27:37 +08:00
🐛 修复群聊启用在带参数不正确的问题
This commit is contained in:
parent
d43fe327c2
commit
c063c69dea
@ -383,6 +383,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
|
|||||||
)
|
)
|
||||||
await md.send_md(reply, bot, event=event)
|
await md.send_md(reply, bot, event=event)
|
||||||
|
|
||||||
|
|
||||||
@on_alconna(
|
@on_alconna(
|
||||||
aliases={"群聊"},
|
aliases={"群聊"},
|
||||||
command=Alconna(
|
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):
|
async def _(bot: T_Bot, event: T_MessageEvent, gm: Matcher, result: Arparma):
|
||||||
ulang = get_user_lang(str(event.user_id))
|
ulang = get_user_lang(str(event.user_id))
|
||||||
to_enable = result.subcommands.get(enable) is not None
|
to_enable = result.subcommands.get(enable) is not None
|
||||||
|
|
||||||
group_id = None
|
group_id = None
|
||||||
if await SUPERUSER(bot, event):
|
if await SUPERUSER(bot, event):
|
||||||
# 仅超级用户可以自定义群号
|
# 仅超级用户可以自定义群号
|
||||||
group_id = result.subcommands.get(enable, result.subcommands.get(disable)).args.get("group_id")
|
group_id = result.subcommands.get(enable, result.subcommands.get(disable)).args.get("group_id")
|
||||||
|
|
||||||
if group_id is None and event.message_type == "group":
|
if group_id is None and event.message_type == "group":
|
||||||
group_id = str(event.group_id)
|
group_id = str(event.group_id)
|
||||||
else:
|
|
||||||
|
if group_id is None:
|
||||||
await gm.finish(ulang.get("liteyuki.invalid_command"), liteyuki_pass=True)
|
await gm.finish(ulang.get("liteyuki.invalid_command"), liteyuki_pass=True)
|
||||||
|
|
||||||
enabled = get_group_enable(group_id)
|
enabled = get_group_enable(group_id)
|
||||||
print(enabled, to_enable)
|
|
||||||
if 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),
|
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)
|
liteyuki_pass=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user