Skip to content

Commit

Permalink
feat: Added enum SendMsgResult
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Sep 11, 2021
1 parent a979a82 commit 411c4ef
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/chat/Chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ export class Chat extends Emittery<ChatEventTypes> {
if (options.waitForAck) {
debugMessage(`waiting ack for ${message.id}`);

await result[1];
const sendResult = await result[1];

debugMessage(`ack received for ${message.id} (ACK: ${finalMessage.ack})`);
debugMessage(
`ack received for ${message.id} (ACK: ${finalMessage.ack}, SendResult: ${sendResult})`
);
}

return {
Expand Down
37 changes: 37 additions & 0 deletions src/whatsapp/enums/SendMsgResult.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*!
* Copyright 2021 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';

/** @moduleID 88300
* @whatsapp 2.2134.10
*/
export declare enum SendMsgResult {
OK = 'OK',
ERROR_NETWORK = 'ERROR_NETWORK',
ERROR_EXPIRED = 'ERROR_EXPIRED',
ERROR_CANCELLED = 'ERROR_CANCELLED',
ERROR_UPLOAD = 'ERROR_UPLOAD',
ERROR_UNKNOWN = 'ERROR_UNKNOWN',
}

exportModule(
exports,
{
SendMsgResult: 'SendMsgResult',
},
(m) => m.SendMsgResult
);
17 changes: 17 additions & 0 deletions src/whatsapp/enums/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*!
* Copyright 2021 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.
*/

export * from './SendMsgResult';
3 changes: 2 additions & 1 deletion src/whatsapp/functions/addAndSendMsgToChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
* limitations under the License.
*/

import { SendMsgResult } from '../enums';
import { exportModule } from '../exportModule';
import { ChatModel, ModelPropertiesContructor, MsgModel } from '../models';

export declare function addAndSendMsgToChat(
chat: ChatModel,
message: ModelPropertiesContructor<MsgModel>
): Promise<[Promise<MsgModel>, Promise<string>]>;
): Promise<[Promise<MsgModel>, Promise<SendMsgResult>]>;

exportModule(
exports,
Expand Down
1 change: 1 addition & 0 deletions src/whatsapp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

export * from './collections';
export * as enums from './enums';
export * as functions from './functions';
export * from './misc';
export * from './models';
Expand Down

0 comments on commit 411c4ef

Please sign in to comment.