diff --git a/src/onebot11/actions/DeleteMsg.ts b/src/onebot11/actions/DeleteMsg.ts new file mode 100644 index 0000000..37b7f36 --- /dev/null +++ b/src/onebot11/actions/DeleteMsg.ts @@ -0,0 +1,22 @@ +import { ActionName } from "./types"; +import BaseAction from "./BaseAction"; +import { NTQQApi } from "../../ntqqapi/ntcall"; +import { msgHistory } from "../../common/data"; + +interface Payload { + message_id: string +} + +class DeleteMsg extends BaseAction { + actionName = ActionName.DeleteMsg + + protected async _handle(payload:Payload){ + let msg = msgHistory[payload.message_id] + await NTQQApi.recallMsg({ + chatType: msg.chatType, + peerUid: msg.peerUid + }, [payload.message_id]) + } +} + +export default DeleteMsg \ No newline at end of file diff --git a/src/onebot11/actions/index.ts b/src/onebot11/actions/index.ts index 8d8abbc..42fcda6 100644 --- a/src/onebot11/actions/index.ts +++ b/src/onebot11/actions/index.ts @@ -8,11 +8,13 @@ import GetGroupMemberInfo from './GetGroupMemberInfo' import SendGroupMsg from './SendGroupMsg' import SendPrivateMsg from './SendPrivateMsg' import SendMsg from './SendMsg' +import DeleteMsg from "./DeleteMsg"; export const actionHandlers = [ new GetMsg(), new GetLoginInfo(), new GetFriendList(), new GetGroupList(), new GetGroupInfo(), new GetGroupMemberList(), new GetGroupMemberInfo(), - new SendGroupMsg(), new SendPrivateMsg(), new SendMsg() + new SendGroupMsg(), new SendPrivateMsg(), new SendMsg(), + new DeleteMsg() ] \ No newline at end of file