mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: #1043
This commit is contained in:
23
src/onebot/action/extends/SetGroupKickMembers.ts
Normal file
23
src/onebot/action/extends/SetGroupKickMembers.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
|
import { ActionName } from '@/onebot/action/router';
|
||||||
|
import { Static, Type } from '@sinclair/typebox';
|
||||||
|
|
||||||
|
const SchemaData = Type.Object({
|
||||||
|
group_id: Type.String(),
|
||||||
|
user_id: Type.Array(Type.String()),
|
||||||
|
reject_add_request: Type.Optional(Type.Union([Type.Boolean(), Type.String()])),
|
||||||
|
});
|
||||||
|
|
||||||
|
type Payload = Static<typeof SchemaData>;
|
||||||
|
|
||||||
|
export default class SetGroupKickMembers extends OneBotAction<Payload, null> {
|
||||||
|
override actionName = ActionName.SetGroupKickMembers;
|
||||||
|
override payloadSchema = SchemaData;
|
||||||
|
|
||||||
|
async _handle(payload: Payload): Promise<null> {
|
||||||
|
const rejectReq = payload.reject_add_request?.toString() == 'true';
|
||||||
|
const uids: string[] = await Promise.all(payload.user_id.map(async uin => await this.core.apis.UserApi.getUidByUinV2(uin)));
|
||||||
|
await this.core.apis.GroupApi.kickMember(payload.group_id.toString(), uids.filter(uid => !!uid), rejectReq);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@@ -119,10 +119,12 @@ import { GetDoubtFriendsAddRequest } from './new/GetDoubtFriendsAddRequest';
|
|||||||
import SetGroupAddOption from './extends/SetGroupAddOption';
|
import SetGroupAddOption from './extends/SetGroupAddOption';
|
||||||
import SetGroupSearch from './extends/SetGroupSearch';
|
import SetGroupSearch from './extends/SetGroupSearch';
|
||||||
import SetGroupRobotAddOption from './extends/SetGroupRobotAddOption';
|
import SetGroupRobotAddOption from './extends/SetGroupRobotAddOption';
|
||||||
|
import SetGroupKickMembers from './extends/SetGroupKickMembers';
|
||||||
|
|
||||||
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
||||||
|
|
||||||
const actionHandlers = [
|
const actionHandlers = [
|
||||||
|
new SetGroupKickMembers(obContext, core),
|
||||||
new SetGroupAddOption(obContext, core),
|
new SetGroupAddOption(obContext, core),
|
||||||
new SetGroupRobotAddOption(obContext, core),
|
new SetGroupRobotAddOption(obContext, core),
|
||||||
new SetGroupSearch(obContext, core),
|
new SetGroupSearch(obContext, core),
|
||||||
|
@@ -10,6 +10,7 @@ export interface InvalidCheckResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ActionName = {
|
export const ActionName = {
|
||||||
|
SetGroupKickMembers: 'set_group_kick_members',
|
||||||
SetGroupRobotAddOption: 'set_group_robot_add_option',
|
SetGroupRobotAddOption: 'set_group_robot_add_option',
|
||||||
SetGroupAddOption: 'set_group_add_option',
|
SetGroupAddOption: 'set_group_add_option',
|
||||||
SetGroupSearch: 'set_group_search',
|
SetGroupSearch: 'set_group_search',
|
||||||
|
Reference in New Issue
Block a user