Skip to content

Commit 3cf0ced

Browse files
committed
test: status/stories
1 parent 41fa700 commit 3cf0ced

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* Fixed require fileName for document only in base64 for send media message
2828
* Bug fix when sending mobile message change contact name to number in chatwoot
2929
* Bug fix when connecting whatsapp does not send confirmation message
30+
* Fixed quoted message with id or message directly
3031

3132
### Integrations
3233

src/validate/validate.schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ const quotedOptionsSchema: JSONSchema7 = {
8282
remoteJid: { type: 'string' },
8383
fromMe: { type: 'boolean', enum: [true, false] },
8484
},
85-
required: ['id', 'remoteJid', 'fromMe'],
86-
...isNotEmpty('id', 'remoteJid'),
85+
required: ['id'],
86+
...isNotEmpty('id'),
8787
},
8888
message: { type: 'object' },
8989
},

src/whatsapp/guards/instance.guard.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import { InstanceDto } from '../dto/instance.dto';
1212
import { cache, waMonitor } from '../whatsapp.module';
1313
import { Database, Redis, configService } from '../../config/env.config';
14-
import { RedisCache } from '../../db/redis.client';
1514

1615
async function getInstance(instanceName: string) {
1716
const db = configService.get<Database>('DATABASE');

src/whatsapp/services/chatwoot.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ export class ChatwootService {
936936

937937
const command = messageReceived.replace('/', '');
938938

939-
if (command === 'init') {
939+
if (command === 'init' || command === 'iniciar') {
940940
this.logger.verbose('command init found');
941941
const state = waInstance?.connectionStatus?.state;
942942

@@ -977,7 +977,7 @@ export class ChatwootService {
977977
}
978978
}
979979

980-
if (command === 'disconnect') {
980+
if (command === 'disconnect' || command === 'desconectar') {
981981
this.logger.verbose('command disconnect found');
982982

983983
const msgLogout = `🚨 Disconnecting Whatsapp from inbox *${body.inbox.name}*: `;

src/whatsapp/services/whatsapp.service.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,17 @@ export class WAStartupService {
14801480
let quoted: WAMessage;
14811481

14821482
if (options?.quoted) {
1483-
quoted = options?.quoted;
1483+
const m = options?.quoted;
1484+
1485+
const msg = m?.message
1486+
? m
1487+
: ((await this.getMessage(m.key, true)) as proto.IWebMessageInfo);
1488+
1489+
if (!msg) {
1490+
throw 'Message not found';
1491+
}
1492+
1493+
quoted = msg;
14841494
this.logger.verbose('Quoted message');
14851495
}
14861496

@@ -1776,8 +1786,10 @@ export class WAStartupService {
17761786

17771787
public async statusMessage(data: SendStatusDto) {
17781788
this.logger.verbose('Sending status message');
1789+
const status = await this.formatStatusMessage(data.statusMessage);
1790+
17791791
return await this.sendMessageWithTyping('status@broadcast', {
1780-
status: await this.formatStatusMessage(data.statusMessage),
1792+
status,
17811793
});
17821794
}
17831795

0 commit comments

Comments
 (0)