diff --git a/src/whatsapp/functions/index.ts b/src/whatsapp/functions/index.ts index a06de51975..ad5b74accc 100644 --- a/src/whatsapp/functions/index.ts +++ b/src/whatsapp/functions/index.ts @@ -110,6 +110,7 @@ export * from './queryNewsletterMetadataByJid'; export * from './queryOrder'; export * from './randomHex'; export * from './randomId'; +export * from './removeStatusMessage'; export * from './resetGroupInviteCode'; export * from './revokeStatus'; export * from './sendClear'; diff --git a/src/whatsapp/functions/removeStatusMessage.ts b/src/whatsapp/functions/removeStatusMessage.ts new file mode 100644 index 0000000000..30330709e3 --- /dev/null +++ b/src/whatsapp/functions/removeStatusMessage.ts @@ -0,0 +1,30 @@ +/*! + * Copyright 2024 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { exportModule } from '../exportModule'; + +/** + * @whatsapp WAWebDBMessageDelete + */ +export declare function removeStatusMessage(id: string[]): Promise; + +exportModule( + exports, + { + removeStatusMessage: ['removeStatusMessage'], + }, + (m) => m.removeStatusMessage +); diff --git a/src/whatsapp/functions/revokeStatus.ts b/src/whatsapp/functions/revokeStatus.ts index 663f67448d..a0190108e8 100644 --- a/src/whatsapp/functions/revokeStatus.ts +++ b/src/whatsapp/functions/revokeStatus.ts @@ -14,8 +14,10 @@ * limitations under the License. */ +import { injectFallbackModule } from '../../webpack'; import { exportModule } from '../exportModule'; import { ChatModel, MsgModel } from '../models'; +import { removeStatusMessage } from './removeStatusMessage'; /** * @whatsapp WAWebRevokeStatusAction @@ -28,7 +30,14 @@ export declare function revokeStatus( exportModule( exports, { - revokeStatus: 'default', + revokeStatus: ['default'], }, (m) => m.default?.displayName?.includes('RevokeStatusAction') ); + +injectFallbackModule('revokeStatus', { + default: async (chat: ChatModel, b: MsgModel) => { + await (chat as any).revokeMsgs([b.id.toString()]); + await removeStatusMessage([b.id.toString()]); + }, +});