mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-10 05:29:02 +08:00
27 lines
932 B
TypeScript
27 lines
932 B
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
|
|
const SchemaData = Type.Object({
|
|
group_id: Type.String(),
|
|
no_code_finger_open: Type.Optional(Type.Number()),
|
|
no_finger_open: Type.Optional(Type.Number()),
|
|
});
|
|
|
|
type Payload = Static<typeof SchemaData>;
|
|
|
|
export default class SetGroupSearch extends OneBotAction<Payload, null> {
|
|
override actionName = ActionName.SetGroupSearch;
|
|
override payloadSchema = SchemaData;
|
|
async _handle (payload: Payload): Promise<null> {
|
|
const ret = await this.core.apis.GroupApi.setGroupSearch(payload.group_id, {
|
|
noCodeFingerOpenFlag: payload.no_code_finger_open,
|
|
noFingerOpenFlag: payload.no_finger_open,
|
|
});
|
|
if (ret.result !== 0) {
|
|
throw new Error(`设置群搜索失败, ${ret.result}:${ret.errMsg}`);
|
|
}
|
|
return null;
|
|
}
|
|
}
|