Skip to content

Commit

Permalink
fix: Fixed error in revokeStatus function
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Oct 17, 2024
1 parent 133f4c2 commit 137415d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/whatsapp/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
30 changes: 30 additions & 0 deletions src/whatsapp/functions/removeStatusMessage.ts
Original file line number Diff line number Diff line change
@@ -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<any>;

exportModule(
exports,
{
removeStatusMessage: ['removeStatusMessage'],
},
(m) => m.removeStatusMessage
);
11 changes: 10 additions & 1 deletion src/whatsapp/functions/revokeStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()]);
},
});

0 comments on commit 137415d

Please sign in to comment.