UNPKG

superchats

Version:

SuperChats is a premium library with unique features that control Whatsapp functions. With Superchats you can build service bots, multiservice chats or any system that uses whatsapp

41 lines (40 loc) 1.96 kB
import { AxiosRequestConfig } from 'axios'; import { proto } from '../../Connection/enc'; import { AuthenticationCreds, OrkestralEventEmitter, SignalKeyStoreWithTransaction, SocketConfig } from '../../Models'; type ProcessMessageContext = { shouldProcessHistoryMsg: boolean; creds: AuthenticationCreds; keyStore: SignalKeyStoreWithTransaction; ev: OrkestralEventEmitter; getMessage: SocketConfig['getMessage']; logger?: any; options: AxiosRequestConfig<{}>; }; /** Cleans a received message to further processing */ export declare const cleanMessage: (message: proto.IWebMessageInfo, meId: string) => void; export declare const isRealMessage: (message: proto.IWebMessageInfo, meId: string) => boolean | undefined; export declare const shouldIncrementChatUnread: (message: proto.IWebMessageInfo) => boolean; /** * Get the ID of the chat from the given key. * Typically -- that'll be the remoteJid, but for broadcasts, it'll be the participant */ export declare const getChatId: ({ remoteJid, participant, fromMe }: proto.IMessageKey) => string; type PollContext = { /** normalised jid of the person that created the poll */ pollCreatorJid: string; /** ID of the poll creation message */ pollMsgId: string; /** poll creation message enc key */ pollEncKey: Uint8Array; /** jid of the person that voted */ voterJid: string; }; /** * Decrypt a poll vote * @param vote encrypted vote * @param ctx additional info about the poll required for decryption * @returns list of SHA256 options */ export declare function decryptPollVote({ encPayload, encIv }: proto.Message.IPollEncValue, { pollCreatorJid, pollMsgId, pollEncKey, voterJid, }: PollContext): proto.Message.PollVoteMessage; declare const processMessage: (message: proto.IWebMessageInfo, { shouldProcessHistoryMsg, ev, creds, keyStore, logger, options, getMessage }: ProcessMessageContext) => Promise<void>; export default processMessage;