NapCatQQ
This commit is contained in:
1 parent
0ef3e38d70
commit
356aba762c
218 files changed
+8465
-5
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { GroupRequestOperateTypes } from '@/core/qqnt/entities';
|
||||
import { ActionName } from '../types';
|
||||
import { NTQQGroupApi } from '@/core/qqnt/apis/group';
|
||||
import { groupNotifies } from '@/common/data';
|
||||
|
||||
interface Payload {
|
||||
flag: string,
|
||||
// sub_type: "add" | "invite",
|
||||
// type: "add" | "invite"
|
||||
approve: boolean,
|
||||
reason: string
|
||||
}
|
||||
|
||||
export default class SetGroupAddRequest extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupAddRequest;
|
||||
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
||||
const flag = payload.flag.toString();
|
||||
const approve = payload.approve.toString() === 'true';
|
||||
const notify = groupNotifies[flag];
|
||||
if (!notify) {
|
||||
throw `${flag}对应的加群通知不存在`;
|
||||
}
|
||||
await NTQQGroupApi.handleGroupRequest(notify,
|
||||
approve ? GroupRequestOperateTypes.approve : GroupRequestOperateTypes.reject,
|
||||
payload.reason
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user