From 690f3bdd659b48fb6426378c610d4159b907300f Mon Sep 17 00:00:00 2001 From: adk23333 <2633103794@qq.com> Date: Thu, 21 Dec 2023 01:32:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E4=BB=A4=E6=9D=83=E9=99=90=E4=BB=8E?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=94=B9=E4=B8=BA=E7=BE=A4=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmds.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmds.py b/cmds.py index e40492d..b3f813c 100644 --- a/cmds.py +++ b/cmds.py @@ -64,9 +64,8 @@ def cmds(app, data): action="store_true") parser.add_argument('-g', '--group', help='组名') parser.add_argument('-m', '--command', help='命令名') - parser.add_argument('-au', '--adduser', help='添加用户到组', + parser.add_argument('-au', '--adduser', help='添加用户/群到组', action="store_true") - parser.add_argument('-u', '--user', help='用户QQ号') args = parser.parse_args(sqt.args) e: AsyncEnforcer = sqt.app.ctx.e @@ -80,9 +79,9 @@ def cmds(app, data): else: msg = Message(content='缺失参数,请使用-h查看帮助', room_id=sqt.room_id) if args.adduser: - if args.user and args.group: - if await e.add_role_for_user(args.user, args.group): - msg = Message(content=f'添加成功:g, {args.user}, {args.group}', room_id=sqt.room_id) + if args.group: + if await e.add_role_for_user(str(sqt.room_id), args.group): + msg = Message(content=f'添加成功:g, {sqt.room_id}, {args.group}', room_id=sqt.room_id) else: msg = Message(content='添加失败,用户已在组内或其它错误', room_id=sqt.room_id) else: