mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-15 11:42:53 -06:00
fix: adjusts in temp folder and return with event send_messages
This commit is contained in:
parent
31486e5963
commit
06cde721b3
@ -984,12 +984,20 @@ export class WAStartupService {
|
|||||||
if (
|
if (
|
||||||
key.remoteJid !== 'status@broadcast' &&
|
key.remoteJid !== 'status@broadcast' &&
|
||||||
!key?.remoteJid?.match(/(:\d+)/) &&
|
!key?.remoteJid?.match(/(:\d+)/) &&
|
||||||
!key.fromMe
|
key.fromMe
|
||||||
) {
|
) {
|
||||||
|
this.logger.verbose('Message update is valid');
|
||||||
|
|
||||||
let pollUpdates: any;
|
let pollUpdates: any;
|
||||||
if (update.pollUpdates) {
|
if (update.pollUpdates) {
|
||||||
|
this.logger.verbose('Poll update found');
|
||||||
|
|
||||||
|
this.logger.verbose('Getting poll message');
|
||||||
const pollCreation = await this.getMessage(key);
|
const pollCreation = await this.getMessage(key);
|
||||||
|
this.logger.verbose(pollCreation);
|
||||||
|
|
||||||
if (pollCreation) {
|
if (pollCreation) {
|
||||||
|
this.logger.verbose('Getting aggregate votes in poll message');
|
||||||
pollUpdates = getAggregateVotesInPollMessage({
|
pollUpdates = getAggregateVotesInPollMessage({
|
||||||
message: pollCreation as proto.IMessage,
|
message: pollCreation as proto.IMessage,
|
||||||
pollUpdates: update.pollUpdates,
|
pollUpdates: update.pollUpdates,
|
||||||
@ -1005,6 +1013,8 @@ export class WAStartupService {
|
|||||||
pollUpdates,
|
pollUpdates,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.logger.verbose(message);
|
||||||
|
|
||||||
this.logger.verbose('Sending data to webhook in event MESSAGES_UPDATE');
|
this.logger.verbose('Sending data to webhook in event MESSAGES_UPDATE');
|
||||||
await this.sendDataWebhook(Events.MESSAGES_UPDATE, message);
|
await this.sendDataWebhook(Events.MESSAGES_UPDATE, message);
|
||||||
|
|
||||||
@ -1367,22 +1377,6 @@ export class WAStartupService {
|
|||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// const messageRaw: proto.IWebMessageInfo = {
|
|
||||||
// key: messageSent.key,
|
|
||||||
// messageTimestamp: Long.isLong(messageSent.messageTimestamp)
|
|
||||||
// ? messageSent.messageTimestamp?.toNumber()
|
|
||||||
// : messageSent.messageTimestamp,
|
|
||||||
// pushName: messageSent.pushName,
|
|
||||||
// broadcast: messageSent.broadcast,
|
|
||||||
// status: 2,
|
|
||||||
// message: { ...messageSent.message },
|
|
||||||
// };
|
|
||||||
|
|
||||||
// this.client.ev.emit('messages.upsert', {
|
|
||||||
// messages: [messageRaw],
|
|
||||||
// type: 'notify',
|
|
||||||
// });
|
|
||||||
|
|
||||||
const messageRaw: MessageRaw = {
|
const messageRaw: MessageRaw = {
|
||||||
key: messageSent.key,
|
key: messageSent.key,
|
||||||
pushName: messageSent.pushName,
|
pushName: messageSent.pushName,
|
||||||
@ -1395,8 +1389,8 @@ export class WAStartupService {
|
|||||||
|
|
||||||
this.logger.log(messageRaw);
|
this.logger.log(messageRaw);
|
||||||
|
|
||||||
this.logger.verbose('Sending data to webhook in event MESSAGES_UPSERT');
|
this.logger.verbose('Sending data to webhook in event SEND_MESSAGE');
|
||||||
await this.sendDataWebhook(Events.MESSAGES_UPSERT, messageRaw);
|
await this.sendDataWebhook(Events.SEND_MESSAGE, messageRaw);
|
||||||
|
|
||||||
this.logger.verbose('Inserting message in database');
|
this.logger.verbose('Inserting message in database');
|
||||||
await this.repository.message.insert(
|
await this.repository.message.insert(
|
||||||
|
Loading…
Reference in New Issue
Block a user