mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 00:10:27 +00:00
chore: 丢弃废弃代码
This commit is contained in:
@@ -8,7 +8,7 @@ const SchemaData = {
|
||||
properties: {
|
||||
group_id: { type: ['number', 'string'] },
|
||||
user_id: { type: ['number', 'string'] },
|
||||
enable: { type: 'boolean' },
|
||||
enable: { type: ['boolean', 'string'] },
|
||||
},
|
||||
required: ['group_id', 'user_id'],
|
||||
} as const satisfies JSONSchema;
|
||||
@@ -20,11 +20,12 @@ export default class SetGroupAdmin extends BaseAction<Payload, null> {
|
||||
PayloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload): Promise<null> {
|
||||
const enable = typeof payload.enable === 'string' ? payload.enable === 'true' : payload.enable;
|
||||
const NTQQGroupApi = this.CoreContext.apis.GroupApi;
|
||||
const NTQQUserApi = this.CoreContext.apis.UserApi;
|
||||
const uid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
|
||||
if (!uid) throw new Error('get Uid Error');
|
||||
await NTQQGroupApi.setMemberRole(payload.group_id.toString(), uid, payload.enable ? GroupMemberRole.admin : GroupMemberRole.normal);
|
||||
await NTQQGroupApi.setMemberRole(payload.group_id.toString(), uid, enable ? GroupMemberRole.admin : GroupMemberRole.normal);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user