mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-27 03:11:21 +08:00
27 lines
857 B
TypeScript
27 lines
857 B
TypeScript
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|
import { ActionName } from '@/onebot/action/router';
|
|
import { MessageUnique } from '@/common/message-unique';
|
|
import { z } from 'zod';
|
|
import { actionType } from '@/common/coerce';
|
|
const SchemaData = z.object({
|
|
message_id: actionType.string(),
|
|
});
|
|
|
|
type Payload = z.infer<typeof SchemaData>;
|
|
|
|
export default class SetEssenceMsg extends OneBotAction<Payload, unknown> {
|
|
override actionName = ActionName.SetEssenceMsg;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle(payload: Payload) {
|
|
const msg = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id);
|
|
if (!msg) {
|
|
throw new Error('msg not found');
|
|
}
|
|
return await this.core.apis.GroupApi.addGroupEssence(
|
|
msg.Peer.peerUid,
|
|
msg.MsgId,
|
|
);
|
|
}
|
|
}
|