@@ -29,12 +29,7 @@ import makeWASocket, {
2929 WAMessage ,
3030 WAMessageUpdate ,
3131 WASocket ,
32- WAMessageKey ,
33- WAMessageContent ,
3432 getAggregateVotesInPollMessage ,
35- jidNormalizedUser ,
36- getKeyAuthor ,
37- decryptPollVote ,
3833} from '@evolution/base' ;
3934import {
4035 Auth ,
@@ -44,10 +39,8 @@ import {
4439 Database ,
4540 QrCode ,
4641 Redis ,
47- StoreConf ,
4842 Webhook ,
4943} from '../../config/env.config' ;
50- import { PollUpdateDecrypt } from '../../utils/poll-update-decrypt-message' ;
5144import fs from 'fs' ;
5245import { Logger } from '../../config/logger.config' ;
5346import { INSTANCE_DIR , ROOT_DIR } from '../../config/path.config' ;
@@ -119,7 +112,6 @@ import { WebhookRaw } from '../models/webhook.model';
119112import { dbserver } from '../../db/db.connect' ;
120113import NodeCache from 'node-cache' ;
121114import { useMultiFileAuthStateRedisDb } from '../../utils/use-multi-file-auth-state-redis-db' ;
122- import { promisify } from 'util' ;
123115import sharp from 'sharp' ;
124116
125117export class WAStartupService {
@@ -726,49 +718,6 @@ export class WAStartupService {
726718 received . messageTimestamp = received . messageTimestamp ?. toNumber ( ) ;
727719 }
728720
729- // if (received.message?.pollUpdateMessage) {
730- // const creationMsgKey = received.message.pollUpdateMessage.pollCreationMessageKey;
731- // const pollCreation = (await this.getMessage(
732- // creationMsgKey,
733- // true,
734- // )) as proto.IWebMessageInfo;
735-
736- // if (pollCreation) {
737- // const meIdNormalised = jidNormalizedUser(this.instance.wuid);
738- // const pollCreatorJid = getKeyAuthor(creationMsgKey, meIdNormalised);
739- // const voterJid = getKeyAuthor(received.key!, meIdNormalised);
740- // const pollEncKey = pollCreation.message?.messageContextInfo?.messageSecret;
741- // // const voteMsg = decryptPollVote(received.message.pollUpdateMessage.vote, {
742- // // pollEncKey,
743- // // pollCreatorJid,
744- // // pollMsgId: creationMsgKey.id,
745- // // voterJid,
746- // // });
747- // // console.log('voteMsg: ', voteMsg);
748- // // console.log(
749- // // pollEncKey,
750- // // received.message?.pollUpdateMessage.vote.encPayload,
751- // // received.message?.pollUpdateMessage.vote.encIv,
752- // // pollCreatorJid,
753- // // pollCreation.key.id,
754- // // voterJid,
755- // // );
756- // const hash = await PollUpdateDecrypt.decrypt(
757- // pollEncKey, // from PollCreationMessage, HAS to be Uint8Array
758- // received.message?.pollUpdateMessage.vote.encPayload, // from PollUpdateMessage, HAS to be Uint8Array
759- // received.message?.pollUpdateMessage.vote.encIv, // from PollUpdateMessage, HAS to be Uint8Array
760- // pollCreatorJid, // PollCreationMessage sender jid (author)
761- // pollCreation.key.id, // Message ID of the PollCreationMessage (can be gotten via the store & pollCreationMessageKey property on the update)
762- // voterJid, // PollUpdateMessage sender jid (author) \\ from above
763- // );
764- // const opt = pollCreation.message?.pollCreationMessage?.options.map(
765- // (o) => o.optionName,
766- // );
767- // const option = await PollUpdateDecrypt.compare(opt, hash);
768- // console.log('option: ', option);
769- // }
770- // }
771-
772721 const messageRaw : MessageRaw = {
773722 key : received . key ,
774723 pushName : received . pushName ,
@@ -1218,6 +1167,7 @@ export class WAStartupService {
12181167 imagePath = `${ join ( process . cwd ( ) , 'temp' , 'temp-sticker.png' ) } ` ;
12191168 await sharp ( imageBuffer ) . toFile ( imagePath ) ;
12201169 }
1170+
12211171 await sharp ( imagePath ) . webp ( ) . toFile ( outputPath ) ;
12221172
12231173 return outputPath ;
0 commit comments