指令权限从用户改为群组

This commit is contained in:
San Liy 2023-12-21 01:32:12 +08:00
parent 8611ce65be
commit 690f3bdd65

View File

@ -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: