plogme 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -0
- package/WAProto/WAProto.proto +611 -1170
- package/WAProto/index.d.ts +86878 -0
- package/WAProto/index.js +85157 -109306
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/messages-send.js +23 -0
- package/lib/Utils/messages.js +33 -0
- package/lib/Utils/process-message.js +12 -1
- package/lib/index.d.ts +21 -3
- package/package.json +1 -1
package/lib/Defaults/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
|
|
|
2
2
|
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
3
3
|
import { Browsers } from '../Utils/browser-utils.js';
|
|
4
4
|
import logger from '../Utils/logger.js';
|
|
5
|
-
const version = [2, 3000,
|
|
5
|
+
const version = [2, 3000, 1047412487];
|
|
6
6
|
export const UNAUTHORIZED_CODES = [401, 403, 419];
|
|
7
7
|
export const BIZ_BOT_SUPPORT_PAYLOAD = '{"version":1,"is_ai_message":true,"should_upload_client_logs":false,"should_show_system_message":false,"ticket_id":"7004947587700716","citation_items":[],"ticket_locale":"us"}';
|
|
8
8
|
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
@@ -2604,6 +2604,29 @@ export const makeMessagesSocket = (config) => {
|
|
|
2604
2604
|
socket.getViewOnceInfo = (message) => parseViewOnceInfo(message);
|
|
2605
2605
|
|
|
2606
2606
|
|
|
2607
|
+
/**
|
|
2608
|
+
* Sends an experimental WhatsApp album. The parent album header and each
|
|
2609
|
+
* image/video child are relayed separately and associated by parent key.
|
|
2610
|
+
* Accepts [{ image: ... }, { video: ... }] or [{ type: 'image', data: ... }].
|
|
2611
|
+
*/
|
|
2612
|
+
socket.sendAlbumMessage = async (jid, medias = [], options = {}) => {
|
|
2613
|
+
if (!jid) throw new Boom('sendAlbumMessage requires a target JID', { statusCode: 400 });
|
|
2614
|
+
if (!Array.isArray(medias) || medias.length < 2) {
|
|
2615
|
+
throw new Boom('sendAlbumMessage requires at least two media items', { statusCode: 400 });
|
|
2616
|
+
}
|
|
2617
|
+
const album = medias.map((media, index) => {
|
|
2618
|
+
const normalized = media?.type && media?.data
|
|
2619
|
+
? { [media.type]: media.data }
|
|
2620
|
+
: { ...media };
|
|
2621
|
+
if (index === 0 && options.caption && !normalized.caption) {
|
|
2622
|
+
normalized.caption = options.caption;
|
|
2623
|
+
}
|
|
2624
|
+
return normalized;
|
|
2625
|
+
});
|
|
2626
|
+
return socket.sendMessage(jid, { album }, options);
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2629
|
+
|
|
2607
2630
|
/**
|
|
2608
2631
|
* Sends an HTML message — renders raw HTML inside the chat bubble.
|
|
2609
2632
|
* Uses FOAHtmlPrimitiveDemoDONOTUSE for full HTML/CSS/JS rendering.
|
package/lib/Utils/messages.js
CHANGED
|
@@ -1016,6 +1016,33 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1016
1016
|
else if (hasNonNullishProperty(message, 'requestPhoneNumber')) {
|
|
1017
1017
|
m.requestPhoneNumberMessage = {};
|
|
1018
1018
|
}
|
|
1019
|
+
else if (hasNonNullishProperty(message, 'chatTheme')) {
|
|
1020
|
+
const theme = message.chatTheme || {};
|
|
1021
|
+
const themeSetting = {};
|
|
1022
|
+
if (theme.animatedWallpaper) {
|
|
1023
|
+
const wallpaper = theme.animatedWallpaper;
|
|
1024
|
+
themeSetting.animatedWallpaper = proto.Message.ChatAnimatedWallpaper.fromObject({
|
|
1025
|
+
animatedWallpaperId: wallpaper.id || wallpaper.animatedWallpaperId,
|
|
1026
|
+
dimLevel: wallpaper.dimLevel ?? (wallpaper.opacity != null ? wallpaper.opacity / 100 : 0)
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
if (Object.keys(themeSetting).length) {
|
|
1030
|
+
m.protocolMessage = {
|
|
1031
|
+
type: proto.Message.ProtocolMessage.Type.CHAT_THEME_SETTING,
|
|
1032
|
+
chatThemeSetting: proto.Message.ChatThemeSetting.fromObject(themeSetting)
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
else if (hasNonNullishProperty(message, 'newsletterFollowerInvite') ||
|
|
1037
|
+
hasNonNullishProperty(message, 'newsletterFollowerInviteMessage') ||
|
|
1038
|
+
hasNonNullishProperty(message, 'newsletterFollowerInviteMessageV2')) {
|
|
1039
|
+
const isV2 = hasNonNullishProperty(message, 'newsletterFollowerInviteMessageV2');
|
|
1040
|
+
const invite = isV2
|
|
1041
|
+
? message.newsletterFollowerInviteMessageV2
|
|
1042
|
+
: (message.newsletterFollowerInvite ?? message.newsletterFollowerInviteMessage);
|
|
1043
|
+
const field = isV2 ? 'newsletterFollowerInviteMessageV2' : 'newsletterFollowerInviteMessage';
|
|
1044
|
+
m = { [field]: proto.Message.NewsletterFollowerInviteMessage.fromObject(invite) };
|
|
1045
|
+
}
|
|
1019
1046
|
else if (hasNonNullishProperty(message, 'limitSharing')) {
|
|
1020
1047
|
m.protocolMessage = {
|
|
1021
1048
|
type: proto.Message.ProtocolMessage.Type.LIMIT_SHARING,
|
|
@@ -1033,6 +1060,12 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1033
1060
|
m.audioMessage.backgroundArgb = await assertColor(options.backgroundColor);
|
|
1034
1061
|
}
|
|
1035
1062
|
}
|
|
1063
|
+
if (m.stickerMessage && hasNonNullishProperty(message, 'stickerAudio')) {
|
|
1064
|
+
const audioPrepared = await prepareWAMessageMedia({ audio: message.stickerAudio, ptt: true }, options);
|
|
1065
|
+
if (audioPrepared?.audioMessage) {
|
|
1066
|
+
m.stickerMessage.audioMessage = audioPrepared.audioMessage;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1036
1069
|
// Lia@Changes 30-01-26 --- Add interactive messages (buttonsMessage, listMessage, interactiveMessage, templateMessage, and carouselMessage)
|
|
1037
1070
|
if (hasNonNullishProperty(message, 'buttons')) {
|
|
1038
1071
|
const buttonsMessage = {
|
|
@@ -138,6 +138,17 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
const content = normalizeMessageContent(message.message);
|
|
141
|
+
if (content?.acp2SettingMessage) {
|
|
142
|
+
const acp2Setting = message.messageContextInfo?.acp2Setting;
|
|
143
|
+
if (acp2Setting) {
|
|
144
|
+
Object.assign(chat, {
|
|
145
|
+
acp2Enabled: acp2Setting.enabled || false,
|
|
146
|
+
acp2SettingTimestamp: toNumber(acp2Setting.settingTimestamp) || toNumber(message.messageTimestamp),
|
|
147
|
+
acp2Trigger: acp2Setting.trigger,
|
|
148
|
+
acp2InitiatedByMe: acp2Setting.initiatedByMe || false
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
141
152
|
// unarchive chat if it's a real message, or someone reacted to our message
|
|
142
153
|
// and we've the unarchive chats setting on
|
|
143
154
|
if ((isRealMsg || content?.reactionMessage?.key?.fromMe) && accountSettings?.unarchiveChats) {
|
|
@@ -579,4 +590,4 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
579
590
|
ev.emit('chats.update', [chat]);
|
|
580
591
|
}
|
|
581
592
|
};
|
|
582
|
-
export default processMessage;
|
|
593
|
+
export default processMessage;
|
package/lib/index.d.ts
CHANGED
|
@@ -213,17 +213,33 @@ export interface RelayMessageOptions {
|
|
|
213
213
|
/** Retry resend target; requires a device JID and retry count. */
|
|
214
214
|
participants?: { jid: string; count: number };
|
|
215
215
|
retryParticipants?: { jid: string; count: number };
|
|
216
|
-
/** Keep only the target's primary device. */
|
|
216
|
+
/** Keep only the target's primary device in supported private-chat fan-out paths; not encryption. */
|
|
217
217
|
isSecret?: boolean;
|
|
218
|
-
/** Skip the target's linked devices. */
|
|
218
|
+
/** Skip the target's linked devices in supported private-chat fan-out paths; enforcement is client-dependent. */
|
|
219
219
|
protected?: boolean;
|
|
220
|
-
/** Keep only the sender's own devices. */
|
|
220
|
+
/** Keep only the sender's own devices in supported private-chat fan-out paths. */
|
|
221
221
|
me?: boolean;
|
|
222
222
|
[key: string]: unknown;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
export interface AlbumMediaInput {
|
|
226
|
+
image?: unknown;
|
|
227
|
+
video?: unknown;
|
|
228
|
+
caption?: string;
|
|
229
|
+
[key: string]: unknown;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface AnimatedWallpaperInput {
|
|
233
|
+
id?: string;
|
|
234
|
+
animatedWallpaperId?: string;
|
|
235
|
+
dimLevel?: number;
|
|
236
|
+
opacity?: number;
|
|
237
|
+
}
|
|
238
|
+
|
|
225
239
|
export interface WASocket {
|
|
226
240
|
sendMessage(jid: string | string[], content: StatusContent | GroupStatusContent | Record<string, unknown>, options?: Partial<StatusOptions> & Record<string, unknown>): Promise<unknown>;
|
|
241
|
+
/** Send at least two image/video items as an experimental WhatsApp album. */
|
|
242
|
+
sendAlbumMessage(jid: string, medias: AlbumMediaInput[], options?: Record<string, unknown>): Promise<unknown>;
|
|
227
243
|
/** Update the connected account's WhatsApp About/profile status. */
|
|
228
244
|
updateProfileStatus(status: string): Promise<void>;
|
|
229
245
|
/** Update the connected account's profile name. */
|
|
@@ -234,6 +250,8 @@ export interface WASocket {
|
|
|
234
250
|
relayMessage(jid: string, message: Record<string, unknown>, options?: RelayMessageOptions): Promise<unknown>;
|
|
235
251
|
/** Send an experimental Meta AI-style rich menu with image, card buttons, and an optional URL footer. */
|
|
236
252
|
richMenu(jid: string, content?: RichMenuContent, options?: Record<string, unknown>): Promise<unknown>;
|
|
253
|
+
/** Send raw HTML through the experimental WhatsApp HTML primitive. */
|
|
254
|
+
sendHtmlMessage(jid: string, content: { html: string; trustedSources?: string[] }, options?: Record<string, unknown>): Promise<unknown>;
|
|
237
255
|
/** Post a personal status using explicit viewers or a configured contact source/provider. */
|
|
238
256
|
sendStatus(content: Omit<StatusContent, 'statusJidList'>, options?: Partial<StatusOptions> & { statusJidList?: string[] }): Promise<unknown>;
|
|
239
257
|
/** Publish a status and create status-mention references for the supplied users or groups. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plogme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Production-ready Baileys fork \u2689 with AI groups, Meta AI prompting, safe compositing fallbacks, rich responses, interactive messages, albums, newsletters, and communities \u2014 without antiban wrappers.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|