Skip to content

Commit

Permalink
✨ perf: 简化命令
Browse files Browse the repository at this point in the history
  • Loading branch information
yzyyz1387 committed Jan 2, 2025
1 parent e6280c7 commit 4c5d75c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ send_time_night = "23 0" # 选填 晚上发送时间默认为22:00
超级用户删他人头衔:删头衔 @某人
【管理员】permission=SUPERUSER | GROUP_OWNER
gl+ @xxx 设置某人为管理员
管理员+ @xxx 设置某人为管理员
管理员加 @xxx 设置某人为管理员
加管理 @xxx 设置某人为管理员
gl- @xxx 取消某人管理员
管理员- @xxx 取消某人管理员
管理员减 @xxx 取消某人管理员
减管理 @xxx 取消某人管理员
Expand All @@ -142,30 +145,40 @@ send_time_night = "23 0" # 选填 晚上发送时间默认为22:00
【加群自动审批】:
群内发送 permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER
查看词条 : 查看本群审批词条 或/审批
ct+ [词条] :增加审批词条 或/审批+
词条+ [词条] :增加审批词条 或/审批+
ct- [词条] :删除审批词条 或/审批-
词条- [词条] :删除审批词条 或/审批-
按照黑名单自动拒绝:(当验证消息与黑名单内容匹配时,自动拒绝)
添加示例:
jj+管理员你好,请通过一下
ctjj+管理员你好,请通过一下
词条拒绝+管理员你好,请通过一下
拒绝词条+管理员你好,请通过一下
/spx+管理员你好,请通过一下
删除示例:
jj-管理员你好,请通过一下
ctjj-管理员你好,请通过一下
词条拒绝-管理员你好,请通过一下
拒绝词条-管理员你好,请通过一下
/spx-管理员你好,请通过一下
【superuser】:
所有词条 : 查看所有审批词条 或/su审批
指定词条+ [群号] [词条] :增加指定群审批词条 或/su审批+
zdct+ [词条] :增加审批词条
指定词条+ [群号] [词条] :增加指定群审批词条
指定词条加 [群号] [词条] :增加指定群审批词条 或/su审批+
指定词条- [群号] [词条] :删除指定群审批词条 或/su审批-
zdct- [词条] :删除审批词条
指定词条- [群号] [词条] :删除指定群审批词条
指定词条减 [群号] [词条] :删除指定群审批词条 或/su审批-
自动审批处理结果将发送给superuser
【分群管理员设置】*分管:可以接受加群处理结果消息的用户
群内发送 permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER
fg+ [user] :user可用@或qq 添加分群管理员
分管+ [user] :user可用@或qq 添加分群管理员
分管加 [user] :user可用@或qq 添加分群管理员
fg- [user] :删除分群管理员
分管- [user] :删除分群管理员
分管减 [user] :删除分群管理员
查看分管 :查看本群分群管理员
Expand Down
4 changes: 2 additions & 2 deletions nonebot_plugin_admin/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async def _(bot: Bot, matcher: Matcher, event: GroupMessageEvent, sb: list = Dep
except ActionFailed:
await fi(matcher, '权限不足')

set_g_admin = on_command('管理员+', aliases={'加管理', '管理加', '加管理员', '管理员加'}, priority=2, block=True, permission=SUPERUSER | GROUP_OWNER)
set_g_admin = on_command('管理员+', aliases={'加管理', '管理加', '加管理员', '管理员加', 'gl+', 'gly+'}, priority=2, block=True, permission=SUPERUSER | GROUP_OWNER)
@set_g_admin.handle()
async def _(bot: Bot, matcher: Matcher, event: GroupMessageEvent, sb: list = Depends(msg_at)):
"""
Expand All @@ -196,7 +196,7 @@ async def _(bot: Bot, matcher: Matcher, event: GroupMessageEvent, sb: list = Dep
except ActionFailed:
await fi(matcher, '权限不足')

unset_g_admin = on_command('管理员-', aliases={'减管理', '管理减', '减管理员', '管理员减'}, priority=2, block=True, permission=SUPERUSER | GROUP_OWNER)
unset_g_admin = on_command('管理员-', aliases={'减管理', '管理减', '减管理员', '管理员减', 'gl-', 'gly-'}, priority=2, block=True, permission=SUPERUSER | GROUP_OWNER)
@unset_g_admin.handle()
async def _(bot: Bot, matcher: Matcher, event: GroupMessageEvent, sb: list = Depends(msg_at)):
"""
Expand Down
4 changes: 2 additions & 2 deletions nonebot_plugin_admin/notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def _(matcher: Matcher):
await matcher.finish(str(admins))

# 添加分群管理员
g_admin = on_command('分管+', priority=2, aliases={'/gad+', '分群管理+', '分管加', '分群管理加'}, block=True,
g_admin = on_command('分管+', priority=2, aliases={'/gad+', '分群管理+', '分管加', '分群管理加', 'fg+'}, block=True,
permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER)
@g_admin.handle()
async def _(matcher: Matcher, event: GroupMessageEvent, state: T_State, sb: list = Depends(msg_at)):
Expand Down Expand Up @@ -67,7 +67,7 @@ async def _(matcher: Matcher):
await matcher.finish('已开启审批消息接收' if status else '已关闭审批消息接收')

# 删除分群管理
g_admin_ = on_command('分管-', priority=2, aliases={'/gad-', '分群管理-', '分管减', '分群管理减'}, block=True,
g_admin_ = on_command('分管-', priority=2, aliases={'/gad-', '分群管理-', '分管减', '分群管理减', 'fg-'}, block=True,
permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER)
@g_admin_.handle()
async def _(matcher: Matcher, event: GroupMessageEvent, state: T_State, sb: list = Depends(msg_at)):
Expand Down
10 changes: 5 additions & 5 deletions nonebot_plugin_admin/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def _(matcher: Matcher):


# 按群号添加词条
super_sp_add = on_command('指定词条+', priority=2, aliases={'/susp+', '/su审批+', "指定词条加"}, block=True, permission=SUPERUSER)
super_sp_add = on_command('指定词条+', priority=2, aliases={'/susp+', '/su审批+', "指定词条加", 'zdct+'}, block=True, permission=SUPERUSER)


@super_sp_add.handle()
Expand All @@ -62,7 +62,7 @@ async def _(matcher: Matcher, event: MessageEvent):


# 按群号删除词条
super_sp_de = on_command('指定词条-', priority=2, aliases={'/susp-', '/su审批-', "指定词条减"}, block=True, permission=SUPERUSER)
super_sp_de = on_command('指定词条-', priority=2, aliases={'/susp-', '/su审批-', "指定词条减", 'zdct-'}, block=True, permission=SUPERUSER)


@super_sp_de.handle()
Expand Down Expand Up @@ -102,7 +102,7 @@ async def _(matcher: Matcher, event: GroupMessageEvent):
await matcher.finish('当前群从未配置过审批词条')


add_appr_term = on_command('词条+', priority=2, aliases={'/sp+', '/审批+', '审批词条加', "词条加"}, block=True,
add_appr_term = on_command('词条+', priority=2, aliases={'/sp+', '/审批+', '审批词条加', "词条加", 'ct+', 'sp+'}, block=True,
permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER)


Expand All @@ -119,7 +119,7 @@ async def _(matcher: Matcher, event: GroupMessageEvent, state: T_State):
await matcher.finish(f"{msg} 已存在于群{gid}的词条中")


del_appr_term = on_command('词条-', priority=2, aliases={'/sp-', '/审批-', '审批词条减', "词条减"}, block=True,
del_appr_term = on_command('词条-', priority=2, aliases={'/sp-', '/审批-', '审批词条减', "词条减", 'ct-', 'sp-'}, block=True,
permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER)


Expand All @@ -139,7 +139,7 @@ async def _(matcher: Matcher, event: GroupMessageEvent, state: T_State):
await matcher.finish("当前群从未配置过词条")


edit_appr_bk = on_command('词条拒绝', priority=2, aliases={'/spx', '/审批拒绝', '拒绝词条'}, block=True,
edit_appr_bk = on_command('词条拒绝', priority=2, aliases={'/spx', '/审批拒绝', '拒绝词条', 'ctjj', 'jj'}, block=True,
permission=GROUP_ADMIN | GROUP_OWNER | SUPERUSER)


Expand Down

0 comments on commit 4c5d75c

Please sign in to comment.