mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-29 21:09:03 +08:00
23 lines
736 B
TypeScript
23 lines
736 B
TypeScript
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|
import { ActionName } from '@/onebot/action/router';
|
|
import { z } from 'zod';
|
|
import { coerce } from '@/common/coerce';
|
|
|
|
const SchemaData = z.object({
|
|
group_id: coerce.string(),
|
|
enable: coerce.boolean().optional(),
|
|
});
|
|
|
|
type Payload = z.infer<typeof SchemaData>;
|
|
|
|
export default class SetGroupWholeBan extends OneBotAction<Payload, null> {
|
|
override actionName = ActionName.SetGroupWholeBan;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle(payload: Payload): Promise<null> {
|
|
const enable = payload.enable?.toString() !== 'false';
|
|
await this.core.apis.GroupApi.banGroup(payload.group_id.toString(), enable);
|
|
return null;
|
|
}
|
|
}
|