mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
28 lines
762 B
TypeScript
28 lines
762 B
TypeScript
|
|
import BaseAction from '../BaseAction';
|
|
import { ActionName } from '../types';
|
|
import { NTQQGroupApi } from '@/ntqqapi/api/group'
|
|
import { MessageUnique } from '@/common/utils/MessageUnique'
|
|
|
|
interface Payload {
|
|
message_id: number | string
|
|
}
|
|
|
|
export default class GoCQHTTPDelEssenceMsg extends BaseAction<Payload, any> {
|
|
actionName = ActionName.GoCQHTTP_DelEssenceMsg;
|
|
|
|
protected async _handle(payload: Payload): Promise<any> {
|
|
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 NTQQGroupApi.removeGroupEssence(
|
|
msg.Peer.peerUid,
|
|
msg.MsgId,
|
|
)
|
|
}
|
|
}
|