Files
LLOneBot/src/onebot11/action/go-cqhttp/DelEssenceMsg.ts
idranme 970f1a98ec chore: improve code quality
chore: improve code quality
2024-09-06 23:03:04 +08:00

26 lines
688 B
TypeScript

import BaseAction from '../BaseAction'
import { ActionName } from '../types'
import { MessageUnique } from '@/common/utils/messageUnique'
interface Payload {
message_id: number | string
}
export class DelEssenceMsg extends BaseAction<Payload, unknown> {
actionName = ActionName.GoCQHTTP_DelEssenceMsg
protected async _handle(payload: Payload) {
if (!payload.message_id) {
throw Error('message_id不能为空')
}
const msg = await MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id)
if (!msg) {
throw new Error('msg not found')
}
return await this.ctx.ntGroupApi.removeGroupEssence(
msg.Peer.peerUid,
msg.MsgId,
)
}
}