mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
refactor(ban): 优化 ban 命令和相关功能
- 修复 ban 命令中的 reason 参数可选标记 - 完善恶意触发检测和用户昵称违规的禁言信息 - 统一禁言操作的参数顺序,提高代码可读性
This commit is contained in:
parent
fa75148ca3
commit
04d74f1f63
@ -119,7 +119,7 @@ _ban_matcher = on_alconna(
|
||||
Alconna(
|
||||
"ban",
|
||||
Args["user?", [str, At]],
|
||||
Option("-r|--reason", Args["reason?", str]),
|
||||
Option("-r|--reason", Args["reason", str]),
|
||||
Option("-g|--group", Args["group_id", str]),
|
||||
Option("-t|--time", Args["duration", int]),
|
||||
),
|
||||
|
||||
@ -92,7 +92,12 @@ async def _(
|
||||
if module:
|
||||
if _blmt.check(f"{user_id}__{module}"):
|
||||
await BanConsole.ban(
|
||||
user_id, group_id, 9, malicious_ban_time * 60, bot.self_id
|
||||
user_id,
|
||||
group_id,
|
||||
9,
|
||||
"恶意触发命令检测",
|
||||
malicious_ban_time * 60,
|
||||
bot.self_id,
|
||||
)
|
||||
logger.info(
|
||||
f"触发了恶意触发检测: {matcher.plugin_name}",
|
||||
|
||||
@ -275,7 +275,9 @@ async def _(bot: Bot, session: Uninfo):
|
||||
await GroupInfoUser.set_user_nickname(session.user.id, group_id, "")
|
||||
else:
|
||||
await FriendUser.set_user_nickname(session.user.id, "")
|
||||
await BanConsole.ban(session.user.id, group_id, 9, 60, bot.self_id)
|
||||
await BanConsole.ban(
|
||||
session.user.id, group_id, 9, "用户昵称违规", 60, bot.self_id
|
||||
)
|
||||
return
|
||||
else:
|
||||
await MessageUtils.build_message("你在做梦吗?你没有昵称啊").finish(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user