kage-baileys 25.3.25 → 25.3.27
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/WAProto/index.js +56 -4
- package/extras/WAProto/E2E/E2E.proto +0 -4
- package/package.json +2 -2
- package/Example/plugins/audiosticker.js +0 -1170
package/WAProto/index.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* Fixed WAProto entrypoint for kage-baileys.
|
|
4
|
+
* Missing generated index.js + shape differences between the old monolithic
|
|
5
|
+
* WAProto and the new split protos under extras/WAProto.
|
|
6
|
+
*
|
|
7
|
+
* Also applies permanent Audio Sticker support (field 134 audioStickerMessage
|
|
8
|
+
* on Message + field 26 audioMessage on StickerMessage) so plugins such as
|
|
9
|
+
* stickeraudio / audiosticker / Tensura-style audioSticker can encode the
|
|
10
|
+
* combined message without conflicting runtime hacks.
|
|
11
|
+
*
|
|
12
|
+
* Compatible with:
|
|
13
|
+
* - kage native audio-sticker util (field 134)
|
|
14
|
+
* - Tensura / Mahiru audioSticker.js patches (field 1074 wire tag = field 134)
|
|
15
|
+
* Sets both __audioStickerKagePatchedV3 and __mahiruAudioStickerPatched so
|
|
16
|
+
* external patches skip and do not double-encode.
|
|
17
|
+
*/
|
|
2
18
|
const raw = require('../extras/WAProto');
|
|
3
19
|
let proto = raw.proto || raw;
|
|
4
20
|
|
|
21
|
+
// ---------- Normalize namespaces so legacy Baileys code keeps working ----------
|
|
22
|
+
|
|
23
|
+
// 1. Message lives under E2E in the new protos
|
|
5
24
|
if (proto.E2E && proto.E2E.Message && !proto.Message) {
|
|
6
25
|
proto.Message = proto.E2E.Message;
|
|
7
26
|
}
|
|
8
27
|
|
|
28
|
+
// 2. HistorySyncType location differs
|
|
9
29
|
const histType =
|
|
10
30
|
(proto.HistorySync && proto.HistorySync.HistorySync && proto.HistorySync.HistorySync.HistorySyncType) ||
|
|
11
31
|
(proto.HistorySync && proto.HistorySync.HistorySyncType) ||
|
|
@@ -21,27 +41,43 @@ if (histType) {
|
|
|
21
41
|
}
|
|
22
42
|
}
|
|
23
43
|
|
|
44
|
+
// 3. Common other aliases that appear in Baileys code
|
|
24
45
|
if (proto.E2E) {
|
|
25
46
|
if (proto.E2E.WebMessageInfo && !proto.WebMessageInfo) {
|
|
26
47
|
proto.WebMessageInfo = proto.E2E.WebMessageInfo;
|
|
27
48
|
}
|
|
28
49
|
}
|
|
29
50
|
|
|
51
|
+
// Apply original field-name compatibility patches
|
|
30
52
|
try {
|
|
31
53
|
require('./compat.cjs')(proto);
|
|
32
54
|
} catch (_) {}
|
|
33
55
|
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Audio Sticker support (permanent, idempotent, dual-flag for Tensura/Mahiru)
|
|
58
|
+
// Protobuf tags:
|
|
59
|
+
// Message.audioStickerMessage = 134 → tag 1074 (length-delimited)
|
|
60
|
+
// StickerMessage.audioMessage = 26 → tag 210 (length-delimited)
|
|
61
|
+
// The generated E2E.js lags behind WAProto.proto; this ensures encode /
|
|
62
|
+
// fromObject always handle the fields used by audio-sticker plugins.
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
34
64
|
function applyAudioStickerSupport(p) {
|
|
35
65
|
const M = p && p.Message;
|
|
36
66
|
if (!M) return;
|
|
67
|
+
|
|
68
|
+
// Already applied completely by this module
|
|
37
69
|
if (M.__kageAudioStickerEncodeComplete) {
|
|
38
70
|
M.__audioStickerKagePatchedV3 = true;
|
|
39
71
|
M.__mahiruAudioStickerPatched = true;
|
|
40
|
-
M.__audioStickerPatched = true;
|
|
41
72
|
return;
|
|
42
73
|
}
|
|
43
|
-
if (!M.StickerMessage || !M.AudioMessage || !M.FutureProofMessage) return;
|
|
44
74
|
|
|
75
|
+
if (!M.StickerMessage || !M.AudioMessage || !M.FutureProofMessage) {
|
|
76
|
+
// Classes missing → leave untouched so normal stickers still work
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// --- StickerMessage.encode: append audioMessage (field 26 / tag 210) ---
|
|
45
81
|
const previousStickerEncode = M.StickerMessage.encode;
|
|
46
82
|
M.StickerMessage.encode = function (message, writer) {
|
|
47
83
|
const hasAudio = message && Object.prototype.hasOwnProperty.call(message, 'audioMessage');
|
|
@@ -50,6 +86,7 @@ function applyAudioStickerSupport(p) {
|
|
|
50
86
|
try {
|
|
51
87
|
const result = previousStickerEncode.call(this, message, writer);
|
|
52
88
|
if (audio) {
|
|
89
|
+
// field 26, wire type 2 → tag 210
|
|
53
90
|
M.AudioMessage.encode(audio, result.uint32(210).fork()).ldelim();
|
|
54
91
|
}
|
|
55
92
|
return result;
|
|
@@ -58,6 +95,7 @@ function applyAudioStickerSupport(p) {
|
|
|
58
95
|
}
|
|
59
96
|
};
|
|
60
97
|
|
|
98
|
+
// --- StickerMessage.fromObject: accept audioMessage ---
|
|
61
99
|
if (typeof M.StickerMessage.fromObject === 'function') {
|
|
62
100
|
const previousStickerFromObject = M.StickerMessage.fromObject;
|
|
63
101
|
M.StickerMessage.fromObject = function (object) {
|
|
@@ -71,24 +109,34 @@ function applyAudioStickerSupport(p) {
|
|
|
71
109
|
};
|
|
72
110
|
}
|
|
73
111
|
|
|
112
|
+
// Ensure prototype property exists (for hasOwnProperty / toObject paths)
|
|
74
113
|
if (!Object.prototype.hasOwnProperty.call(M.StickerMessage.prototype, 'audioMessage')) {
|
|
75
114
|
M.StickerMessage.prototype.audioMessage = null;
|
|
76
115
|
}
|
|
77
116
|
|
|
117
|
+
// --- Message.encode: emit audioStickerMessage (field 134 / tag 1074) ---
|
|
78
118
|
const previousMessageEncode = M.encode;
|
|
79
119
|
M.encode = function (message, writer) {
|
|
80
120
|
const hasAudioSticker = message && Object.prototype.hasOwnProperty.call(message, 'audioStickerMessage');
|
|
81
121
|
const hasSticker = message && Object.prototype.hasOwnProperty.call(message, 'stickerMessage');
|
|
82
122
|
const audioSticker = hasAudioSticker ? message.audioStickerMessage : null;
|
|
83
123
|
const stickerMessage = hasSticker ? message.stickerMessage : null;
|
|
124
|
+
|
|
84
125
|
if (hasAudioSticker) {
|
|
85
126
|
delete message.audioStickerMessage;
|
|
127
|
+
// Prefer the nested sticker inside audioStickerMessage when present
|
|
128
|
+
// (Tensura/Mahiru payload puts sticker under audioStickerMessage.message)
|
|
86
129
|
if (hasSticker) delete message.stickerMessage;
|
|
87
130
|
}
|
|
131
|
+
|
|
88
132
|
try {
|
|
89
133
|
const result = previousMessageEncode.call(this, message, writer);
|
|
90
134
|
if (audioSticker) {
|
|
91
|
-
|
|
135
|
+
// field 134, wire type 2 → tag 1074
|
|
136
|
+
M.FutureProofMessage.encode(
|
|
137
|
+
audioSticker,
|
|
138
|
+
result.uint32(1074).fork()
|
|
139
|
+
).ldelim();
|
|
92
140
|
}
|
|
93
141
|
return result;
|
|
94
142
|
} finally {
|
|
@@ -97,12 +145,14 @@ function applyAudioStickerSupport(p) {
|
|
|
97
145
|
}
|
|
98
146
|
};
|
|
99
147
|
|
|
148
|
+
// --- Message.fromObject: accept audioStickerMessage ---
|
|
100
149
|
if (typeof M.fromObject === 'function') {
|
|
101
150
|
const previousMessageFromObject = M.fromObject;
|
|
102
151
|
M.fromObject = function (object) {
|
|
103
152
|
const message = previousMessageFromObject.call(this, object);
|
|
104
153
|
if (object && object.audioStickerMessage) {
|
|
105
154
|
const inner = object.audioStickerMessage.message || object.audioStickerMessage;
|
|
155
|
+
// Preserve nested stickerMessage.audioMessage if present (Tensura path)
|
|
106
156
|
if (
|
|
107
157
|
inner &&
|
|
108
158
|
inner.stickerMessage &&
|
|
@@ -116,6 +166,7 @@ function applyAudioStickerSupport(p) {
|
|
|
116
166
|
message.audioStickerMessage = M.FutureProofMessage.fromObject
|
|
117
167
|
? M.FutureProofMessage.fromObject({ message: inner })
|
|
118
168
|
: { message: inner };
|
|
169
|
+
// Match Tensura behavior: drop top-level sticker when audio sticker is set
|
|
119
170
|
if (message.stickerMessage && inner && inner.stickerMessage) {
|
|
120
171
|
delete message.stickerMessage;
|
|
121
172
|
}
|
|
@@ -128,16 +179,17 @@ function applyAudioStickerSupport(p) {
|
|
|
128
179
|
M.prototype.audioStickerMessage = null;
|
|
129
180
|
}
|
|
130
181
|
|
|
182
|
+
// Dual flags: kage native + Tensura/Mahiru style so external patches skip
|
|
131
183
|
M.__audioStickerKagePatchedV3 = true;
|
|
132
184
|
M.__mahiruAudioStickerPatched = true;
|
|
133
185
|
M.__tensuraAudioStickerPatched = true;
|
|
134
|
-
M.__audioStickerPatched = true;
|
|
135
186
|
M.__kageAudioStickerEncodeComplete = true;
|
|
136
187
|
}
|
|
137
188
|
|
|
138
189
|
try {
|
|
139
190
|
applyAudioStickerSupport(proto);
|
|
140
191
|
} catch (err) {
|
|
192
|
+
// Never break loading of WAProto because of the optional audio-sticker patch
|
|
141
193
|
if (typeof console !== 'undefined' && console.warn) {
|
|
142
194
|
console.warn('[kage-baileys/WAProto] Audio Sticker patch skipped:', err && err.message);
|
|
143
195
|
}
|
|
@@ -729,7 +729,6 @@ message Message {
|
|
|
729
729
|
optional StatusQuestionAnswerMessage statusQuestionAnswerMessage = 105;
|
|
730
730
|
optional FutureProofMessage questionReplyMessage = 106;
|
|
731
731
|
optional QuestionResponseMessage questionResponseMessage = 107;
|
|
732
|
-
optional FutureProofMessage audioStickerMessage = 134;
|
|
733
732
|
message AlbumMessage {
|
|
734
733
|
optional uint32 expectedImageCount = 2;
|
|
735
734
|
optional uint32 expectedVideoCount = 3;
|
|
@@ -1909,9 +1908,6 @@ message Message {
|
|
|
1909
1908
|
optional bool isLottie = 21;
|
|
1910
1909
|
optional string accessibilityLabel = 22;
|
|
1911
1910
|
optional Message.MediaKeyDomain mediaKeyDomain = 23;
|
|
1912
|
-
optional int32 premium = 24;
|
|
1913
|
-
optional string emojis = 25;
|
|
1914
|
-
optional AudioMessage audioMessage = 26;
|
|
1915
1911
|
}
|
|
1916
1912
|
message StickerPackMessage {
|
|
1917
1913
|
optional string stickerPackId = 1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kage-baileys",
|
|
3
|
-
"version": "25.3.
|
|
4
|
-
"description": "Kage Baileys,
|
|
3
|
+
"version": "25.3.27",
|
|
4
|
+
"description": "Kage Baileys full merge — Builders + mbuilder + Framework + advanced sticker packs + KAGE pairing + extended WAProto. Multi-device ready. FIXED: all core modules deduplicated, removed third-party libsignal-node fork. [audio-sticker patch for Mahiru/Tensura compatibility] [audio-sticker patch for Mahiru/Tensura compatibility]",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kage-baileys",
|
|
7
7
|
"baileys",
|
|
@@ -1,1170 +0,0 @@
|
|
|
1
|
-
import { sticker } from '../lib/sticker.js'
|
|
2
|
-
import {
|
|
3
|
-
prepareWAMessageMedia,
|
|
4
|
-
proto,
|
|
5
|
-
downloadMediaMessage,
|
|
6
|
-
downloadContentFromMessage
|
|
7
|
-
} from 'kage-baileys'
|
|
8
|
-
import { randomBytes } from 'node:crypto'
|
|
9
|
-
import { execFile } from 'node:child_process'
|
|
10
|
-
import { promisify } from 'node:util'
|
|
11
|
-
import fs from 'node:fs/promises'
|
|
12
|
-
import path from 'node:path'
|
|
13
|
-
import os from 'node:os'
|
|
14
|
-
|
|
15
|
-
const execFileAsync = promisify(execFile)
|
|
16
|
-
const MAX_DURATION = 25
|
|
17
|
-
const SESSION_SECONDS = 60
|
|
18
|
-
const MAX_STICKER_SIZE = 880 * 1024
|
|
19
|
-
|
|
20
|
-
if (!globalThis.__audioStickerSessions) {
|
|
21
|
-
globalThis.__audioStickerSessions = new Map()
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const sessions = globalThis.__audioStickerSessions
|
|
25
|
-
|
|
26
|
-
function patchProtoInstance(p) {
|
|
27
|
-
const M = p?.Message
|
|
28
|
-
|
|
29
|
-
if (!M || M.__audioStickerKagePatchedV2 || M.__audioStickerKagePatchedV3) return
|
|
30
|
-
|
|
31
|
-
if (!M.StickerMessage || !M.AudioMessage || !M.FutureProofMessage) {
|
|
32
|
-
throw new Error('La versión instalada de Kage Baileys no contiene las clases protobuf necesarias para Audio Sticker.')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const previousStickerEncode = M.StickerMessage.encode
|
|
36
|
-
|
|
37
|
-
M.StickerMessage.encode = function (message, writer) {
|
|
38
|
-
const hasAudio = message && Object.prototype.hasOwnProperty.call(message, 'audioMessage')
|
|
39
|
-
const audio = hasAudio ? message.audioMessage : null
|
|
40
|
-
|
|
41
|
-
if (hasAudio) delete message.audioMessage
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
const result = previousStickerEncode.call(this, message, writer)
|
|
45
|
-
|
|
46
|
-
if (audio) {
|
|
47
|
-
M.AudioMessage.encode(audio, result.uint32(210).fork()).ldelim()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return result
|
|
51
|
-
} finally {
|
|
52
|
-
if (hasAudio) message.audioMessage = audio
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (typeof M.StickerMessage.fromObject === 'function') {
|
|
57
|
-
const previousStickerFromObject = M.StickerMessage.fromObject
|
|
58
|
-
|
|
59
|
-
M.StickerMessage.fromObject = function (object) {
|
|
60
|
-
const message = previousStickerFromObject.call(this, object)
|
|
61
|
-
|
|
62
|
-
if (object?.audioMessage) {
|
|
63
|
-
message.audioMessage = M.AudioMessage.fromObject
|
|
64
|
-
? M.AudioMessage.fromObject(object.audioMessage)
|
|
65
|
-
: object.audioMessage
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return message
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const previousMessageEncode = M.encode
|
|
73
|
-
|
|
74
|
-
M.encode = function (message, writer) {
|
|
75
|
-
const hasAudioSticker = message && Object.prototype.hasOwnProperty.call(message, 'audioStickerMessage')
|
|
76
|
-
const hasSticker = message && Object.prototype.hasOwnProperty.call(message, 'stickerMessage')
|
|
77
|
-
const audioSticker = hasAudioSticker ? message.audioStickerMessage : null
|
|
78
|
-
const stickerMessage = hasSticker ? message.stickerMessage : null
|
|
79
|
-
|
|
80
|
-
if (hasAudioSticker) {
|
|
81
|
-
delete message.audioStickerMessage
|
|
82
|
-
if (hasSticker) delete message.stickerMessage
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
try {
|
|
86
|
-
const result = previousMessageEncode.call(this, message, writer)
|
|
87
|
-
|
|
88
|
-
if (audioSticker) {
|
|
89
|
-
M.FutureProofMessage.encode(
|
|
90
|
-
audioSticker,
|
|
91
|
-
result.uint32(1074).fork()
|
|
92
|
-
).ldelim()
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return result
|
|
96
|
-
} finally {
|
|
97
|
-
if (hasAudioSticker && hasSticker) message.stickerMessage = stickerMessage
|
|
98
|
-
if (hasAudioSticker) message.audioStickerMessage = audioSticker
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (typeof M.fromObject === 'function') {
|
|
103
|
-
const previousMessageFromObject = M.fromObject
|
|
104
|
-
|
|
105
|
-
M.fromObject = function (object) {
|
|
106
|
-
const message = previousMessageFromObject.call(this, object)
|
|
107
|
-
|
|
108
|
-
if (object?.audioStickerMessage) {
|
|
109
|
-
const inner = object.audioStickerMessage.message || object.audioStickerMessage
|
|
110
|
-
message.audioStickerMessage = M.FutureProofMessage.fromObject
|
|
111
|
-
? M.FutureProofMessage.fromObject({ message: inner })
|
|
112
|
-
: { message: inner }
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return message
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
M.__audioStickerKagePatchedV2 = true
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function ensurePatched() {
|
|
123
|
-
patchProtoInstance(proto)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function getSessionKey(m) {
|
|
127
|
-
return `${m.chat}:${m.sender}`
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function clearUserSession(key) {
|
|
131
|
-
const session = sessions.get(key)
|
|
132
|
-
if (session?.timer) clearTimeout(session.timer)
|
|
133
|
-
sessions.delete(key)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function unwrapMessageContainer(raw) {
|
|
137
|
-
let current = raw
|
|
138
|
-
|
|
139
|
-
for (let i = 0; i < 6 && current; i++) {
|
|
140
|
-
const next =
|
|
141
|
-
current.ephemeralMessage?.message ||
|
|
142
|
-
current.viewOnceMessageV2?.message ||
|
|
143
|
-
current.viewOnceMessageV2Extension?.message ||
|
|
144
|
-
current.viewOnceMessage?.message ||
|
|
145
|
-
current.documentWithCaptionMessage?.message ||
|
|
146
|
-
current.editedMessage?.message
|
|
147
|
-
|
|
148
|
-
if (!next) break
|
|
149
|
-
current = next
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return current || {}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function detectMediaInfo(node) {
|
|
156
|
-
if (!node) {
|
|
157
|
-
return { kind: null, mime: '', seconds: 0, mediaObj: null, dlType: null }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const container = unwrapMessageContainer(node.message || node.fakeObj?.message || {})
|
|
161
|
-
const mtype =
|
|
162
|
-
node.mtype ||
|
|
163
|
-
node.type ||
|
|
164
|
-
Object.keys(container).find(key =>
|
|
165
|
-
/imageMessage|videoMessage|stickerMessage|audioMessage|documentMessage/i.test(key)
|
|
166
|
-
) ||
|
|
167
|
-
''
|
|
168
|
-
|
|
169
|
-
const directMessage =
|
|
170
|
-
node.msg &&
|
|
171
|
-
typeof node.msg === 'object' &&
|
|
172
|
-
(node.msg.mediaKey || node.msg.url || node.msg.directPath || node.msg.mimetype)
|
|
173
|
-
? node.msg
|
|
174
|
-
: null
|
|
175
|
-
|
|
176
|
-
const mediaObj =
|
|
177
|
-
directMessage ||
|
|
178
|
-
container[mtype] ||
|
|
179
|
-
container.videoMessage ||
|
|
180
|
-
container.imageMessage ||
|
|
181
|
-
container.stickerMessage ||
|
|
182
|
-
container.audioMessage ||
|
|
183
|
-
container.documentMessage ||
|
|
184
|
-
(node.mediaKey || node.url || node.directPath ? node : null)
|
|
185
|
-
|
|
186
|
-
const mime = String(node.mimetype || mediaObj?.mimetype || '').toLowerCase()
|
|
187
|
-
const seconds = Number(mediaObj?.seconds || node.seconds || node.msg?.seconds || 0)
|
|
188
|
-
|
|
189
|
-
if (/video/i.test(mime) || /videoMessage/i.test(mtype)) {
|
|
190
|
-
return {
|
|
191
|
-
kind: 'video',
|
|
192
|
-
mime: mime || 'video/mp4',
|
|
193
|
-
seconds,
|
|
194
|
-
mediaObj,
|
|
195
|
-
dlType: /documentMessage/i.test(mtype) ? 'document' : 'video'
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (/webp/i.test(mime) || /stickerMessage/i.test(mtype)) {
|
|
200
|
-
return {
|
|
201
|
-
kind: 'webp',
|
|
202
|
-
mime: 'image/webp',
|
|
203
|
-
seconds,
|
|
204
|
-
isAnimated: Boolean(mediaObj?.isAnimated),
|
|
205
|
-
mediaObj,
|
|
206
|
-
dlType: 'sticker'
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (/image/i.test(mime) || /imageMessage/i.test(mtype)) {
|
|
211
|
-
return {
|
|
212
|
-
kind: 'image',
|
|
213
|
-
mime: mime || 'image/jpeg',
|
|
214
|
-
seconds: 0,
|
|
215
|
-
mediaObj,
|
|
216
|
-
dlType: /documentMessage/i.test(mtype) ? 'document' : 'image'
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (/audio|ogg|opus|mpeg|mp3|wav|m4a|aac/i.test(mime) || /audioMessage/i.test(mtype)) {
|
|
221
|
-
return {
|
|
222
|
-
kind: 'audio',
|
|
223
|
-
mime: mime || 'audio/mpeg',
|
|
224
|
-
seconds,
|
|
225
|
-
mediaObj,
|
|
226
|
-
dlType: /documentMessage/i.test(mtype) ? 'document' : 'audio'
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return { kind: null, mime: '', seconds: 0, mediaObj: null, dlType: null }
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
async function downloadBuffer(node, info, client) {
|
|
234
|
-
if (!node) return null
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
info?.mediaObj &&
|
|
238
|
-
info?.dlType &&
|
|
239
|
-
(info.mediaObj.mediaKey || info.mediaObj.directPath || info.mediaObj.url)
|
|
240
|
-
) {
|
|
241
|
-
try {
|
|
242
|
-
const stream = await downloadContentFromMessage(info.mediaObj, info.dlType)
|
|
243
|
-
const chunks = []
|
|
244
|
-
|
|
245
|
-
for await (const chunk of stream) chunks.push(chunk)
|
|
246
|
-
|
|
247
|
-
const buffer = Buffer.concat(chunks)
|
|
248
|
-
if (buffer.length) return buffer
|
|
249
|
-
} catch {}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (node.fakeObj?.message || node.message) {
|
|
253
|
-
try {
|
|
254
|
-
const messageObject = node.fakeObj?.message ? node.fakeObj : node
|
|
255
|
-
const buffer = await downloadMediaMessage(
|
|
256
|
-
messageObject,
|
|
257
|
-
'buffer',
|
|
258
|
-
{},
|
|
259
|
-
{
|
|
260
|
-
logger: { info: () => {}, error: () => {}, warn: () => {} },
|
|
261
|
-
reuploadRequest: client?.updateMediaMessage
|
|
262
|
-
}
|
|
263
|
-
)
|
|
264
|
-
|
|
265
|
-
if (buffer?.length) return buffer
|
|
266
|
-
} catch {}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (info?.mediaObj && info?.dlType) {
|
|
270
|
-
try {
|
|
271
|
-
const synthetic = {
|
|
272
|
-
key: node.key || { remoteJid: node.chat || 'status@broadcast', id: '0' },
|
|
273
|
-
message: { [`${info.dlType}Message`]: info.mediaObj }
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const buffer = await downloadMediaMessage(
|
|
277
|
-
synthetic,
|
|
278
|
-
'buffer',
|
|
279
|
-
{},
|
|
280
|
-
{
|
|
281
|
-
logger: { info: () => {}, error: () => {}, warn: () => {} },
|
|
282
|
-
reuploadRequest: client?.updateMediaMessage
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
if (buffer?.length) return buffer
|
|
287
|
-
} catch {}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if (typeof node.download === 'function') {
|
|
291
|
-
try {
|
|
292
|
-
const buffer = await node.download()
|
|
293
|
-
if (buffer?.length) return buffer
|
|
294
|
-
} catch {}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return null
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function buildExifPayload(packname, author, soundSha256Base64 = null) {
|
|
301
|
-
const json = {
|
|
302
|
-
'sticker-pack-id': 'com.mahiru.audiosticker',
|
|
303
|
-
'sticker-pack-name': String(packname ?? ''),
|
|
304
|
-
'sticker-pack-publisher': String(author ?? ''),
|
|
305
|
-
emojis: ['🔊']
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// WhatsApp sound stickers link the webp to the audio via sound-sha256
|
|
309
|
-
// (base64 of the unencrypted audio fileSha256).
|
|
310
|
-
if (soundSha256Base64) {
|
|
311
|
-
json['sound-sha256'] = String(soundSha256Base64)
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const exifAttr = Buffer.from([
|
|
315
|
-
0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00,
|
|
316
|
-
0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00,
|
|
317
|
-
0x00, 0x00, 0x16, 0x00, 0x00, 0x00
|
|
318
|
-
])
|
|
319
|
-
|
|
320
|
-
const jsonBuffer = Buffer.from(JSON.stringify(json), 'utf-8')
|
|
321
|
-
const exif = Buffer.concat([exifAttr, jsonBuffer])
|
|
322
|
-
exif.writeUIntLE(jsonBuffer.length, 14, 4)
|
|
323
|
-
|
|
324
|
-
return exif
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function injectExifRiffFallback(webpBuffer, exifData) {
|
|
328
|
-
if (
|
|
329
|
-
!Buffer.isBuffer(webpBuffer) ||
|
|
330
|
-
webpBuffer.length < 16 ||
|
|
331
|
-
webpBuffer.toString('ascii', 0, 4) !== 'RIFF' ||
|
|
332
|
-
webpBuffer.toString('ascii', 8, 12) !== 'WEBP'
|
|
333
|
-
) {
|
|
334
|
-
return webpBuffer
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
const chunks = []
|
|
338
|
-
let offset = 12
|
|
339
|
-
let hasVp8x = false
|
|
340
|
-
let isAnimated = false
|
|
341
|
-
|
|
342
|
-
while (offset + 8 <= webpBuffer.length) {
|
|
343
|
-
const id = webpBuffer.toString('ascii', offset, offset + 4)
|
|
344
|
-
const size = webpBuffer.readUInt32LE(offset + 4)
|
|
345
|
-
const padded = size + (size % 2)
|
|
346
|
-
const end = Math.min(webpBuffer.length, offset + 8 + padded)
|
|
347
|
-
const rawChunk = Buffer.from(webpBuffer.subarray(offset, end))
|
|
348
|
-
|
|
349
|
-
if (id === 'VP8X') hasVp8x = true
|
|
350
|
-
if (id === 'ANIM' || id === 'ANMF') isAnimated = true
|
|
351
|
-
if (id !== 'EXIF') chunks.push({ id, rawChunk })
|
|
352
|
-
|
|
353
|
-
offset = end
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (!hasVp8x) {
|
|
357
|
-
const vp8x = Buffer.alloc(18)
|
|
358
|
-
vp8x.write('VP8X', 0, 4, 'ascii')
|
|
359
|
-
vp8x.writeUInt32LE(10, 4)
|
|
360
|
-
vp8x[8] = 0x18
|
|
361
|
-
vp8x.writeUIntLE(511, 12, 3)
|
|
362
|
-
vp8x.writeUIntLE(511, 15, 3)
|
|
363
|
-
chunks.unshift({ id: 'VP8X', rawChunk: vp8x })
|
|
364
|
-
} else {
|
|
365
|
-
const entry = chunks.find(chunk => chunk.id === 'VP8X')
|
|
366
|
-
|
|
367
|
-
if (entry && entry.rawChunk.length >= 18) {
|
|
368
|
-
entry.rawChunk[8] |= 0x08
|
|
369
|
-
if (isAnimated) entry.rawChunk[8] |= 0x02
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
const padding = exifData.length % 2 ? Buffer.from([0]) : Buffer.alloc(0)
|
|
374
|
-
const exifHeader = Buffer.alloc(8)
|
|
375
|
-
exifHeader.write('EXIF', 0, 4, 'ascii')
|
|
376
|
-
exifHeader.writeUInt32LE(exifData.length, 4)
|
|
377
|
-
|
|
378
|
-
chunks.push({
|
|
379
|
-
id: 'EXIF',
|
|
380
|
-
rawChunk: Buffer.concat([exifHeader, exifData, padding])
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
const body = Buffer.concat(chunks.map(chunk => chunk.rawChunk))
|
|
384
|
-
const header = Buffer.alloc(12)
|
|
385
|
-
header.write('RIFF', 0, 4, 'ascii')
|
|
386
|
-
header.writeUInt32LE(body.length + 4, 4)
|
|
387
|
-
header.write('WEBP', 8, 4, 'ascii')
|
|
388
|
-
|
|
389
|
-
return Buffer.concat([header, body])
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
async function addStickerExif(webpBuffer, packname, author, soundSha256Base64 = null) {
|
|
393
|
-
const exifData = buildExifPayload(packname, author, soundSha256Base64)
|
|
394
|
-
|
|
395
|
-
try {
|
|
396
|
-
const module = await import('node-webpmux')
|
|
397
|
-
const WebpImage = module.default?.Image || module.Image || module.default
|
|
398
|
-
|
|
399
|
-
if (WebpImage) {
|
|
400
|
-
const image = new WebpImage()
|
|
401
|
-
await image.load(webpBuffer)
|
|
402
|
-
image.exif = exifData
|
|
403
|
-
return await image.save(null)
|
|
404
|
-
}
|
|
405
|
-
} catch {}
|
|
406
|
-
|
|
407
|
-
return injectExifRiffFallback(webpBuffer, exifData)
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
function isWebpAnimated(buffer) {
|
|
411
|
-
if (!Buffer.isBuffer(buffer) || buffer.length < 22) return false
|
|
412
|
-
if (buffer.toString('ascii', 12, 16) === 'VP8X' && (buffer[20] & 0x02) !== 0) return true
|
|
413
|
-
return buffer.includes(Buffer.from('ANIM'))
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
async function getBufferDuration(buffer, ext = 'mp4') {
|
|
417
|
-
const id = randomBytes(6).toString('hex')
|
|
418
|
-
const inputPath = path.join(os.tmpdir(), `as_duration_${id}.${ext}`)
|
|
419
|
-
|
|
420
|
-
try {
|
|
421
|
-
await fs.writeFile(inputPath, buffer)
|
|
422
|
-
const { stdout } = await execFileAsync('ffprobe', [
|
|
423
|
-
'-v', 'error',
|
|
424
|
-
'-show_entries', 'format=duration',
|
|
425
|
-
'-of', 'default=noprint_wrappers=1:nokey=1',
|
|
426
|
-
inputPath
|
|
427
|
-
])
|
|
428
|
-
|
|
429
|
-
const duration = Number(String(stdout).trim())
|
|
430
|
-
return Number.isFinite(duration) ? duration : 0
|
|
431
|
-
} catch {
|
|
432
|
-
return 0
|
|
433
|
-
} finally {
|
|
434
|
-
await fs.unlink(inputPath).catch(() => {})
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
async function videoBufferToAnimatedWebp(buffer) {
|
|
439
|
-
const id = randomBytes(6).toString('hex')
|
|
440
|
-
const inputPath = path.join(os.tmpdir(), `as_video_${id}.mp4`)
|
|
441
|
-
const outputPath = path.join(os.tmpdir(), `as_output_${id}.webp`)
|
|
442
|
-
|
|
443
|
-
const encode = async (fps, quality, size = 512) => {
|
|
444
|
-
await execFileAsync('ffmpeg', [
|
|
445
|
-
'-y',
|
|
446
|
-
'-i', inputPath,
|
|
447
|
-
'-t', String(MAX_DURATION),
|
|
448
|
-
'-vf',
|
|
449
|
-
`fps=${fps},scale=${size}:${size}:force_original_aspect_ratio=decrease,format=rgba,pad=${size}:${size}:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1`,
|
|
450
|
-
'-c:v', 'libwebp',
|
|
451
|
-
'-lossless', '0',
|
|
452
|
-
'-compression_level', '6',
|
|
453
|
-
'-q:v', String(quality),
|
|
454
|
-
'-loop', '0',
|
|
455
|
-
'-preset', 'picture',
|
|
456
|
-
'-an',
|
|
457
|
-
'-vsync', '0',
|
|
458
|
-
outputPath
|
|
459
|
-
])
|
|
460
|
-
|
|
461
|
-
return await fs.readFile(outputPath)
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
try {
|
|
465
|
-
await fs.writeFile(inputPath, buffer)
|
|
466
|
-
|
|
467
|
-
const profiles = [
|
|
468
|
-
[10, 50, 512],
|
|
469
|
-
[8, 36, 512],
|
|
470
|
-
[6, 24, 512],
|
|
471
|
-
[5, 16, 512],
|
|
472
|
-
[5, 14, 448],
|
|
473
|
-
[4, 12, 384]
|
|
474
|
-
]
|
|
475
|
-
|
|
476
|
-
let result = null
|
|
477
|
-
|
|
478
|
-
for (const [fps, quality, size] of profiles) {
|
|
479
|
-
result = await encode(fps, quality, size)
|
|
480
|
-
if (result.length <= MAX_STICKER_SIZE) break
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
if (!result?.length || result.length > MAX_STICKER_SIZE) {
|
|
484
|
-
throw new Error('El video no se pudo reducir al tamaño permitido para un sticker animado.')
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
return result
|
|
488
|
-
} finally {
|
|
489
|
-
await fs.unlink(inputPath).catch(() => {})
|
|
490
|
-
await fs.unlink(outputPath).catch(() => {})
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
async function imageBufferToWebp(buffer) {
|
|
495
|
-
try {
|
|
496
|
-
const sharp = (await import('sharp')).default
|
|
497
|
-
return await sharp(buffer, { animated: true })
|
|
498
|
-
.rotate()
|
|
499
|
-
.resize(512, 512, {
|
|
500
|
-
fit: 'contain',
|
|
501
|
-
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
|
502
|
-
})
|
|
503
|
-
.webp({ quality: 82 })
|
|
504
|
-
.toBuffer()
|
|
505
|
-
} catch {
|
|
506
|
-
const id = randomBytes(6).toString('hex')
|
|
507
|
-
const inputPath = path.join(os.tmpdir(), `as_image_${id}.jpg`)
|
|
508
|
-
const outputPath = path.join(os.tmpdir(), `as_image_${id}.webp`)
|
|
509
|
-
|
|
510
|
-
try {
|
|
511
|
-
await fs.writeFile(inputPath, buffer)
|
|
512
|
-
await execFileAsync('ffmpeg', [
|
|
513
|
-
'-y',
|
|
514
|
-
'-i', inputPath,
|
|
515
|
-
'-vf', 'scale=512:512:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1',
|
|
516
|
-
'-c:v', 'libwebp',
|
|
517
|
-
'-lossless', '0',
|
|
518
|
-
'-q:v', '80',
|
|
519
|
-
'-an',
|
|
520
|
-
outputPath
|
|
521
|
-
])
|
|
522
|
-
|
|
523
|
-
return await fs.readFile(outputPath)
|
|
524
|
-
} finally {
|
|
525
|
-
await fs.unlink(inputPath).catch(() => {})
|
|
526
|
-
await fs.unlink(outputPath).catch(() => {})
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
async function buildStickerWithExif(buffer, kind, packname, author) {
|
|
532
|
-
let webpBuffer
|
|
533
|
-
|
|
534
|
-
if (kind === 'video') {
|
|
535
|
-
webpBuffer = await videoBufferToAnimatedWebp(buffer)
|
|
536
|
-
} else if (kind === 'image') {
|
|
537
|
-
try {
|
|
538
|
-
webpBuffer = await sticker(buffer, false, packname, author)
|
|
539
|
-
if (!Buffer.isBuffer(webpBuffer)) webpBuffer = Buffer.from(webpBuffer)
|
|
540
|
-
} catch {
|
|
541
|
-
webpBuffer = await imageBufferToWebp(buffer)
|
|
542
|
-
}
|
|
543
|
-
} else if (kind === 'webp') {
|
|
544
|
-
webpBuffer = buffer
|
|
545
|
-
} else {
|
|
546
|
-
throw new Error('Formato de imagen no compatible.')
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
if (!webpBuffer?.length) throw new Error('No se pudo generar el sticker WebP.')
|
|
550
|
-
|
|
551
|
-
return await addStickerExif(webpBuffer, packname, author)
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
function parseFfmpegDuration(stderrText) {
|
|
555
|
-
const matches = [...String(stderrText || '').matchAll(/time=(\d+):(\d+):(\d+(?:\.\d+)?)/g)]
|
|
556
|
-
if (!matches.length) return 0
|
|
557
|
-
|
|
558
|
-
const last = matches[matches.length - 1]
|
|
559
|
-
const seconds = Number(last[1]) * 3600 + Number(last[2]) * 60 + Number(last[3])
|
|
560
|
-
|
|
561
|
-
return Number.isFinite(seconds) ? seconds : 0
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
function generateWaveform(seedBuffer, length = 64) {
|
|
565
|
-
const waveform = Buffer.alloc(length)
|
|
566
|
-
|
|
567
|
-
for (let i = 0; i < length; i++) {
|
|
568
|
-
const value = seedBuffer?.length ? seedBuffer[(i * 19 + 7) % seedBuffer.length] : i * 11
|
|
569
|
-
waveform[i] = 18 + (value % 76)
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
return waveform
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
async function convertToOggOpus(buffer, ext = 'mp3') {
|
|
576
|
-
const id = randomBytes(6).toString('hex')
|
|
577
|
-
const inputPath = path.join(os.tmpdir(), `as_audio_${id}.${ext}`)
|
|
578
|
-
const outputPath = path.join(os.tmpdir(), `as_audio_${id}.ogg`)
|
|
579
|
-
|
|
580
|
-
try {
|
|
581
|
-
await fs.writeFile(inputPath, buffer)
|
|
582
|
-
|
|
583
|
-
const { stderr } = await execFileAsync('ffmpeg', [
|
|
584
|
-
'-y',
|
|
585
|
-
'-i', inputPath,
|
|
586
|
-
'-vn',
|
|
587
|
-
'-map', '0:a:0',
|
|
588
|
-
'-t', String(MAX_DURATION),
|
|
589
|
-
'-af', 'aresample=48000:async=1:first_pts=0',
|
|
590
|
-
'-c:a', 'libopus',
|
|
591
|
-
'-b:a', '48k',
|
|
592
|
-
'-vbr', 'on',
|
|
593
|
-
'-compression_level', '10',
|
|
594
|
-
'-ac', '1',
|
|
595
|
-
'-ar', '48000',
|
|
596
|
-
'-application', 'audio',
|
|
597
|
-
'-avoid_negative_ts', 'make_zero',
|
|
598
|
-
'-f', 'ogg',
|
|
599
|
-
outputPath
|
|
600
|
-
])
|
|
601
|
-
|
|
602
|
-
const oggBuffer = await fs.readFile(outputPath)
|
|
603
|
-
if (!oggBuffer || oggBuffer.length < 200) {
|
|
604
|
-
throw new Error('No se encontró audio válido en el archivo.')
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
return { oggBuffer, realSeconds: parseFfmpegDuration(stderr) }
|
|
608
|
-
} finally {
|
|
609
|
-
await fs.unlink(inputPath).catch(() => {})
|
|
610
|
-
await fs.unlink(outputPath).catch(() => {})
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
async function buildAudioMessageFromBuffer(client, buffer, ext, fallbackSeconds = 0) {
|
|
615
|
-
const { oggBuffer, realSeconds } = await convertToOggOpus(buffer, ext)
|
|
616
|
-
// Sound stickers require a normal audio upload (NOT PTT / voice note).
|
|
617
|
-
const prepared = await prepareWAMessageMedia(
|
|
618
|
-
{
|
|
619
|
-
audio: oggBuffer,
|
|
620
|
-
mimetype: 'audio/ogg; codecs=opus',
|
|
621
|
-
ptt: false
|
|
622
|
-
},
|
|
623
|
-
{
|
|
624
|
-
upload: client.waUploadToServer,
|
|
625
|
-
logger: client.logger
|
|
626
|
-
}
|
|
627
|
-
)
|
|
628
|
-
|
|
629
|
-
if (!prepared?.audioMessage) throw new Error('No se pudo preparar el audio para WhatsApp.')
|
|
630
|
-
|
|
631
|
-
const chosenSeconds = realSeconds > 0
|
|
632
|
-
? realSeconds
|
|
633
|
-
: fallbackSeconds > 0
|
|
634
|
-
? fallbackSeconds
|
|
635
|
-
: 5
|
|
636
|
-
|
|
637
|
-
const audioMessage = { ...prepared.audioMessage }
|
|
638
|
-
audioMessage.seconds = Math.max(1, Math.min(MAX_DURATION, Math.round(chosenSeconds)))
|
|
639
|
-
// Critical: ptt must stay false inside StickerMessage.audioMessage
|
|
640
|
-
audioMessage.ptt = false
|
|
641
|
-
audioMessage.mimetype = 'audio/ogg; codecs=opus'
|
|
642
|
-
|
|
643
|
-
// Drop waveform — official sound stickers do not include it
|
|
644
|
-
if (audioMessage.waveform) delete audioMessage.waveform
|
|
645
|
-
|
|
646
|
-
return audioMessage
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
async function sendCombinedAudioSticker(client, chat, stickerBuffer, isAnimated, audioMessage) {
|
|
650
|
-
ensurePatched()
|
|
651
|
-
|
|
652
|
-
if (typeof client?.waUploadToServer !== 'function') {
|
|
653
|
-
throw new Error('La conexión Kage Baileys no tiene waUploadToServer disponible.')
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
if (typeof client?.relayMessage !== 'function') {
|
|
657
|
-
throw new Error('La conexión Kage Baileys no tiene relayMessage disponible.')
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// Re-inject EXIF with sound-sha256 so the webp is linked to the audio clip
|
|
661
|
-
let finalSticker = stickerBuffer
|
|
662
|
-
try {
|
|
663
|
-
const sha = audioMessage?.fileSha256
|
|
664
|
-
if (sha && (Buffer.isBuffer(sha) || sha instanceof Uint8Array)) {
|
|
665
|
-
const b64 = Buffer.from(sha).toString('base64')
|
|
666
|
-
finalSticker = await addStickerExif(stickerBuffer, 'Audio Sticker', 'Kage', b64)
|
|
667
|
-
}
|
|
668
|
-
} catch (e) {
|
|
669
|
-
console.warn('[AUDIO STICKER] EXIF sound-sha256 skip:', e?.message || e)
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
const prepared = await prepareWAMessageMedia(
|
|
673
|
-
{
|
|
674
|
-
sticker: finalSticker,
|
|
675
|
-
isAnimated: Boolean(isAnimated)
|
|
676
|
-
},
|
|
677
|
-
{
|
|
678
|
-
upload: client.waUploadToServer,
|
|
679
|
-
logger: client.logger
|
|
680
|
-
}
|
|
681
|
-
)
|
|
682
|
-
|
|
683
|
-
if (!prepared?.stickerMessage) {
|
|
684
|
-
throw new Error('Kage Baileys no pudo preparar el sticker.')
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
// Official layout (from real WA clients / Baileys#2932):
|
|
688
|
-
// Message {
|
|
689
|
-
// audioStickerMessage (134): FutureProofMessage {
|
|
690
|
-
// message: {
|
|
691
|
-
// stickerMessage: {
|
|
692
|
-
// ...sticker fields...,
|
|
693
|
-
// premium: 0, // field 24
|
|
694
|
-
// emojis: "🔊", // field 25 (optional)
|
|
695
|
-
// audioMessage: {...} // field 26
|
|
696
|
-
// }
|
|
697
|
-
// }
|
|
698
|
-
// }
|
|
699
|
-
// }
|
|
700
|
-
// IMPORTANT: do NOT put stickerMessage at the top level, or clients show a plain sticker.
|
|
701
|
-
const stickerMessage = {
|
|
702
|
-
...prepared.stickerMessage,
|
|
703
|
-
isAnimated: Boolean(isAnimated),
|
|
704
|
-
premium: 0,
|
|
705
|
-
emojis: '🔊',
|
|
706
|
-
audioMessage
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
const payload = {
|
|
710
|
-
audioStickerMessage: {
|
|
711
|
-
message: {
|
|
712
|
-
stickerMessage
|
|
713
|
-
}
|
|
714
|
-
},
|
|
715
|
-
messageContextInfo: {
|
|
716
|
-
messageSecret: randomBytes(32)
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
const encoded = proto.Message.encode(payload).finish()
|
|
721
|
-
const buf = Buffer.from(encoded)
|
|
722
|
-
const audioStickerTag = Buffer.from([0xb2, 0x08]) // field 134
|
|
723
|
-
const audioInsideTag = Buffer.from([0xd2, 0x01]) // field 26 inside StickerMessage
|
|
724
|
-
|
|
725
|
-
if (!buf.includes(audioStickerTag)) {
|
|
726
|
-
throw new Error('Kage Baileys no pudo serializar el campo audioStickerMessage (134).')
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
if (!buf.includes(audioInsideTag)) {
|
|
730
|
-
throw new Error('Kage Baileys no pudo serializar el audio dentro de StickerMessage (26).')
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
// Also ensure there is NO top-level stickerMessage tag (field 26 = 0xd2 0x01 at root would be wrong context,
|
|
734
|
-
// but the presence of only 134 is what matters for clients).
|
|
735
|
-
await client.relayMessage(chat, payload, {})
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
function getReplyFunction(m, conn) {
|
|
739
|
-
return async text => {
|
|
740
|
-
if (typeof m.reply === 'function') return m.reply(text)
|
|
741
|
-
if (typeof conn.reply === 'function') return conn.reply(m.chat, text, m)
|
|
742
|
-
return conn.sendMessage(m.chat, { text }, { quoted: m })
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
async function reactMessage(m, conn, emoji) {
|
|
747
|
-
try {
|
|
748
|
-
if (typeof m.react === 'function') return await m.react(emoji)
|
|
749
|
-
if (conn?.sendMessage) {
|
|
750
|
-
return await conn.sendMessage(m.chat, {
|
|
751
|
-
react: { text: emoji, key: m.key }
|
|
752
|
-
})
|
|
753
|
-
}
|
|
754
|
-
} catch {}
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
function makeStatus(rows) {
|
|
758
|
-
let txt = `み❑ *A U D I O - S T I C K E R* ✿\n\n`
|
|
759
|
-
|
|
760
|
-
for (const [label, value] of rows) {
|
|
761
|
-
txt += `> *₊·や✿ね ${label}* » ${value}\n`
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
return txt.trimEnd()
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
function startStickerSession({ m, client, send, stickerBuffer, isAnimated, packname, author, usedPrefix, command }) {
|
|
768
|
-
const key = getSessionKey(m)
|
|
769
|
-
clearUserSession(key)
|
|
770
|
-
|
|
771
|
-
const timer = setTimeout(() => {
|
|
772
|
-
if (!sessions.has(key)) return
|
|
773
|
-
sessions.delete(key)
|
|
774
|
-
|
|
775
|
-
client.sendMessage(m.chat, {
|
|
776
|
-
text: makeStatus([
|
|
777
|
-
['Resultado', '⏰ Sesión finalizada'],
|
|
778
|
-
['Tiempo', `${SESSION_SECONDS} segundos agotados`]
|
|
779
|
-
])
|
|
780
|
-
}, { quoted: m }).catch(() => {})
|
|
781
|
-
}, SESSION_SECONDS * 1000)
|
|
782
|
-
|
|
783
|
-
sessions.set(key, {
|
|
784
|
-
stickerBuffer,
|
|
785
|
-
isAnimated,
|
|
786
|
-
packname,
|
|
787
|
-
author,
|
|
788
|
-
expiresAt: Date.now() + SESSION_SECONDS * 1000,
|
|
789
|
-
processing: false,
|
|
790
|
-
timer
|
|
791
|
-
})
|
|
792
|
-
|
|
793
|
-
return send(makeStatus([
|
|
794
|
-
['Resultado', '✅ Sesión activada'],
|
|
795
|
-
['Paquete', packname],
|
|
796
|
-
['Autor', author],
|
|
797
|
-
['Tipo', isAnimated ? 'GIF animado' : 'Imagen estática'],
|
|
798
|
-
['Audio máximo', `${MAX_DURATION} segundos`],
|
|
799
|
-
['Tiempo disponible', `${SESSION_SECONDS} segundos`],
|
|
800
|
-
['Siguiente paso', 'Envía un audio, nota de voz o video'],
|
|
801
|
-
['Cancelar', `${usedPrefix}${command} cancelar`]
|
|
802
|
-
]))
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
async function consumeSessionWithMedia(m, client, send, session, mediaNode, mediaInfo) {
|
|
806
|
-
const key = getSessionKey(m)
|
|
807
|
-
session.processing = true
|
|
808
|
-
|
|
809
|
-
await reactMessage(m, client, '🕓')
|
|
810
|
-
|
|
811
|
-
try {
|
|
812
|
-
const mediaBuffer = await downloadBuffer(mediaNode, mediaInfo, client)
|
|
813
|
-
if (!mediaBuffer?.length) throw new Error('No se pudo descargar el audio o video.')
|
|
814
|
-
|
|
815
|
-
const ext = mediaInfo.kind === 'video'
|
|
816
|
-
? 'mp4'
|
|
817
|
-
: /ogg|opus/i.test(mediaInfo.mime)
|
|
818
|
-
? 'ogg'
|
|
819
|
-
: /mp4|m4a|aac/i.test(mediaInfo.mime)
|
|
820
|
-
? 'm4a'
|
|
821
|
-
: /wav/i.test(mediaInfo.mime)
|
|
822
|
-
? 'wav'
|
|
823
|
-
: 'mp3'
|
|
824
|
-
|
|
825
|
-
const realDuration = await getBufferDuration(mediaBuffer, ext)
|
|
826
|
-
const duration = realDuration || mediaInfo.seconds || 0
|
|
827
|
-
|
|
828
|
-
if (duration > MAX_DURATION) {
|
|
829
|
-
throw new Error(`El audio o video supera el máximo de ${MAX_DURATION} segundos.`)
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
const audioMessage = await buildAudioMessageFromBuffer(
|
|
833
|
-
client,
|
|
834
|
-
mediaBuffer,
|
|
835
|
-
ext,
|
|
836
|
-
duration
|
|
837
|
-
)
|
|
838
|
-
|
|
839
|
-
await sendCombinedAudioSticker(
|
|
840
|
-
client,
|
|
841
|
-
m.chat,
|
|
842
|
-
session.stickerBuffer,
|
|
843
|
-
session.isAnimated,
|
|
844
|
-
audioMessage
|
|
845
|
-
)
|
|
846
|
-
|
|
847
|
-
clearUserSession(key)
|
|
848
|
-
await reactMessage(m, client, '✅')
|
|
849
|
-
|
|
850
|
-
await send(makeStatus([
|
|
851
|
-
['Estado', '✅ Audio Sticker enviado'],
|
|
852
|
-
['Audio', 'Incorporado al sticker'],
|
|
853
|
-
['Formato', session.isAnimated ? 'Animado' : 'Estático']
|
|
854
|
-
]))
|
|
855
|
-
} catch (error) {
|
|
856
|
-
session.processing = false
|
|
857
|
-
console.error('[AUDIO STICKER SESSION]', error)
|
|
858
|
-
await reactMessage(m, client, '❌')
|
|
859
|
-
|
|
860
|
-
await send(makeStatus([
|
|
861
|
-
['Resultado', '❌ Error'],
|
|
862
|
-
['Motivo', error?.message || String(error)]
|
|
863
|
-
]))
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
const handler = async (m, {
|
|
868
|
-
conn,
|
|
869
|
-
args = [],
|
|
870
|
-
text,
|
|
871
|
-
usedPrefix = '.',
|
|
872
|
-
command = 'audiosticker'
|
|
873
|
-
}) => {
|
|
874
|
-
const client = conn || m.conn || global.conn || global.sock
|
|
875
|
-
if (!client) return
|
|
876
|
-
|
|
877
|
-
const send = getReplyFunction(m, client)
|
|
878
|
-
const key = getSessionKey(m)
|
|
879
|
-
const activeSession = sessions.get(key)
|
|
880
|
-
const rawText = String(text || args.join(' ') || '').trim()
|
|
881
|
-
|
|
882
|
-
if (/^(cancelar|cancel|stop|batal)$/i.test(rawText)) {
|
|
883
|
-
if (!activeSession) {
|
|
884
|
-
return send(makeStatus([
|
|
885
|
-
['Resultado', '⚠️ No tienes una sesión activa']
|
|
886
|
-
]))
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
clearUserSession(key)
|
|
890
|
-
await reactMessage(m, client, '✅')
|
|
891
|
-
|
|
892
|
-
return send(makeStatus([
|
|
893
|
-
['Resultado', '✅ Sesión cancelada']
|
|
894
|
-
]))
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
const ownInfo = detectMediaInfo(m)
|
|
898
|
-
const quoted = m.quoted
|
|
899
|
-
const quotedInfo = detectMediaInfo(quoted)
|
|
900
|
-
|
|
901
|
-
const isVisual = kind => ['image', 'video', 'webp'].includes(kind)
|
|
902
|
-
const isSound = kind => ['audio', 'video'].includes(kind)
|
|
903
|
-
|
|
904
|
-
const ownVisual = isVisual(ownInfo.kind)
|
|
905
|
-
const quotedVisual = isVisual(quotedInfo.kind)
|
|
906
|
-
const ownSound = isSound(ownInfo.kind)
|
|
907
|
-
const quotedSound = isSound(quotedInfo.kind)
|
|
908
|
-
|
|
909
|
-
if (activeSession && !activeSession.processing && (ownSound || quotedSound)) {
|
|
910
|
-
const targetNode = ownSound ? m : quoted
|
|
911
|
-
const targetInfo = ownSound ? ownInfo : quotedInfo
|
|
912
|
-
|
|
913
|
-
return await consumeSessionWithMedia(
|
|
914
|
-
m,
|
|
915
|
-
client,
|
|
916
|
-
send,
|
|
917
|
-
activeSession,
|
|
918
|
-
targetNode,
|
|
919
|
-
targetInfo
|
|
920
|
-
)
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
if (!ownVisual && !quotedVisual && !ownSound && !quotedSound) {
|
|
924
|
-
if (activeSession) {
|
|
925
|
-
const remaining = Math.max(
|
|
926
|
-
1,
|
|
927
|
-
Math.ceil((activeSession.expiresAt - Date.now()) / 1000)
|
|
928
|
-
)
|
|
929
|
-
|
|
930
|
-
return send(makeStatus([
|
|
931
|
-
['Sesión', '⏳ Activa'],
|
|
932
|
-
['Tiempo restante', `${remaining} segundos`],
|
|
933
|
-
['Siguiente paso', 'Envía un audio o video']
|
|
934
|
-
]))
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
return send(makeStatus([
|
|
938
|
-
['Función', 'Crear sticker con sonido'],
|
|
939
|
-
['Imagen', 'Foto o GIF'],
|
|
940
|
-
['Video', 'Sticker animado con audio'],
|
|
941
|
-
['Audio', 'MP3 o nota de voz'],
|
|
942
|
-
['Duración máxima', `${MAX_DURATION} segundos`],
|
|
943
|
-
['Sesión', `${SESSION_SECONDS} segundos`],
|
|
944
|
-
['Personalizar', `${usedPrefix}${command} Paquete|Autor`]
|
|
945
|
-
]))
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
if (!ownVisual && !quotedVisual && (ownSound || quotedSound)) {
|
|
949
|
-
return send(makeStatus([
|
|
950
|
-
['Resultado', '⚠️ Falta seleccionar una imagen'],
|
|
951
|
-
['Acción', 'Responde a una foto con el comando o envía una foto primero']
|
|
952
|
-
]))
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
await reactMessage(m, client, '🕓')
|
|
956
|
-
|
|
957
|
-
try {
|
|
958
|
-
ensurePatched()
|
|
959
|
-
|
|
960
|
-
const parts = rawText.includes('|')
|
|
961
|
-
? rawText.split('|').map(part => part.trim())
|
|
962
|
-
: [rawText, '']
|
|
963
|
-
|
|
964
|
-
const packname =
|
|
965
|
-
parts[0] ||
|
|
966
|
-
global.packname ||
|
|
967
|
-
global.stickpack ||
|
|
968
|
-
global.packsticker ||
|
|
969
|
-
global.namaBot ||
|
|
970
|
-
'Mahiru Shiina'
|
|
971
|
-
|
|
972
|
-
const author =
|
|
973
|
-
parts[1] ||
|
|
974
|
-
global.author ||
|
|
975
|
-
global.stickauth ||
|
|
976
|
-
global.packsticker2 ||
|
|
977
|
-
global.namaOwner ||
|
|
978
|
-
m.pushName ||
|
|
979
|
-
'Sticker'
|
|
980
|
-
|
|
981
|
-
const visualNode = ownVisual ? m : quoted
|
|
982
|
-
const visualInfo = ownVisual ? ownInfo : quotedInfo
|
|
983
|
-
const visualBuffer = await downloadBuffer(visualNode, visualInfo, client)
|
|
984
|
-
|
|
985
|
-
if (!visualBuffer?.length) throw new Error('No se pudo descargar la foto o el video.')
|
|
986
|
-
|
|
987
|
-
if (visualInfo.kind === 'video') {
|
|
988
|
-
const duration = await getBufferDuration(visualBuffer, 'mp4')
|
|
989
|
-
const videoDuration = duration || visualInfo.seconds || 0
|
|
990
|
-
|
|
991
|
-
if (videoDuration > MAX_DURATION) {
|
|
992
|
-
throw new Error(`El video supera la duración máxima de ${MAX_DURATION} segundos.`)
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
const stickerBuffer = await buildStickerWithExif(
|
|
997
|
-
visualBuffer,
|
|
998
|
-
visualInfo.kind,
|
|
999
|
-
packname,
|
|
1000
|
-
author
|
|
1001
|
-
)
|
|
1002
|
-
|
|
1003
|
-
const isAnimated =
|
|
1004
|
-
visualInfo.kind === 'video' ||
|
|
1005
|
-
Boolean(visualInfo.isAnimated) ||
|
|
1006
|
-
isWebpAnimated(stickerBuffer)
|
|
1007
|
-
|
|
1008
|
-
if (visualInfo.kind === 'video') {
|
|
1009
|
-
const audioMessage = await buildAudioMessageFromBuffer(
|
|
1010
|
-
client,
|
|
1011
|
-
visualBuffer,
|
|
1012
|
-
'mp4',
|
|
1013
|
-
visualInfo.seconds
|
|
1014
|
-
)
|
|
1015
|
-
|
|
1016
|
-
await sendCombinedAudioSticker(
|
|
1017
|
-
client,
|
|
1018
|
-
m.chat,
|
|
1019
|
-
stickerBuffer,
|
|
1020
|
-
true,
|
|
1021
|
-
audioMessage
|
|
1022
|
-
)
|
|
1023
|
-
|
|
1024
|
-
await reactMessage(m, client, '✅')
|
|
1025
|
-
|
|
1026
|
-
return send(makeStatus([
|
|
1027
|
-
['Estado', '✅ Audio Sticker enviado'],
|
|
1028
|
-
['Video', 'Convertido en sticker animado'],
|
|
1029
|
-
['Audio', 'Incorporado al sticker']
|
|
1030
|
-
]))
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
let soundNode = null
|
|
1034
|
-
let soundInfo = null
|
|
1035
|
-
|
|
1036
|
-
if (ownInfo.kind === 'audio' || ownInfo.kind === 'video') {
|
|
1037
|
-
soundNode = m
|
|
1038
|
-
soundInfo = ownInfo
|
|
1039
|
-
} else if (quotedInfo.kind === 'audio' || quotedInfo.kind === 'video') {
|
|
1040
|
-
soundNode = quoted
|
|
1041
|
-
soundInfo = quotedInfo
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
if (soundNode && soundInfo) {
|
|
1045
|
-
const soundBuffer = await downloadBuffer(soundNode, soundInfo, client)
|
|
1046
|
-
if (!soundBuffer?.length) throw new Error('No se pudo descargar el audio o video respondido.')
|
|
1047
|
-
|
|
1048
|
-
const ext = soundInfo.kind === 'video'
|
|
1049
|
-
? 'mp4'
|
|
1050
|
-
: /ogg|opus/i.test(soundInfo.mime)
|
|
1051
|
-
? 'ogg'
|
|
1052
|
-
: /mp4|m4a|aac/i.test(soundInfo.mime)
|
|
1053
|
-
? 'm4a'
|
|
1054
|
-
: /wav/i.test(soundInfo.mime)
|
|
1055
|
-
? 'wav'
|
|
1056
|
-
: 'mp3'
|
|
1057
|
-
|
|
1058
|
-
const duration = await getBufferDuration(soundBuffer, ext)
|
|
1059
|
-
const finalDuration = duration || soundInfo.seconds || 0
|
|
1060
|
-
|
|
1061
|
-
if (finalDuration > MAX_DURATION) {
|
|
1062
|
-
throw new Error(`El audio o video supera los ${MAX_DURATION} segundos permitidos.`)
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
const audioMessage = await buildAudioMessageFromBuffer(
|
|
1066
|
-
client,
|
|
1067
|
-
soundBuffer,
|
|
1068
|
-
ext,
|
|
1069
|
-
finalDuration
|
|
1070
|
-
)
|
|
1071
|
-
|
|
1072
|
-
await sendCombinedAudioSticker(
|
|
1073
|
-
client,
|
|
1074
|
-
m.chat,
|
|
1075
|
-
stickerBuffer,
|
|
1076
|
-
isAnimated,
|
|
1077
|
-
audioMessage
|
|
1078
|
-
)
|
|
1079
|
-
|
|
1080
|
-
await reactMessage(m, client, '✅')
|
|
1081
|
-
|
|
1082
|
-
return send(makeStatus([
|
|
1083
|
-
['Estado', '✅ Audio Sticker enviado'],
|
|
1084
|
-
['Sticker', 'Generado correctamente'],
|
|
1085
|
-
['Audio', 'Incorporado al sticker']
|
|
1086
|
-
]))
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
return await startStickerSession({
|
|
1090
|
-
m,
|
|
1091
|
-
client,
|
|
1092
|
-
send,
|
|
1093
|
-
stickerBuffer,
|
|
1094
|
-
isAnimated,
|
|
1095
|
-
packname,
|
|
1096
|
-
author,
|
|
1097
|
-
usedPrefix,
|
|
1098
|
-
command
|
|
1099
|
-
})
|
|
1100
|
-
} catch (error) {
|
|
1101
|
-
console.error('[AUDIO STICKER ERROR]', error)
|
|
1102
|
-
await reactMessage(m, client, '❌')
|
|
1103
|
-
|
|
1104
|
-
return send(makeStatus([
|
|
1105
|
-
['Resultado', '❌ Error'],
|
|
1106
|
-
['Motivo', error?.message || String(error)],
|
|
1107
|
-
['Acción', 'Intenta nuevamente']
|
|
1108
|
-
]))
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
handler.before = async (m, extra = {}) => {
|
|
1113
|
-
if (!m || m.fromMe) return false
|
|
1114
|
-
|
|
1115
|
-
const key = getSessionKey(m)
|
|
1116
|
-
const session = sessions.get(key)
|
|
1117
|
-
|
|
1118
|
-
if (!session || session.processing) return false
|
|
1119
|
-
|
|
1120
|
-
if (Date.now() > session.expiresAt) {
|
|
1121
|
-
clearUserSession(key)
|
|
1122
|
-
return false
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
const bodyText = String(m.text || m.body || '').trim()
|
|
1126
|
-
|
|
1127
|
-
if (/^[./!#]?(audiosticker|stikeraudio|stickeraudio|figurinhasom|saudio)\b/i.test(bodyText)) {
|
|
1128
|
-
return false
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
const ownInfo = detectMediaInfo(m)
|
|
1132
|
-
const quotedInfo = detectMediaInfo(m.quoted)
|
|
1133
|
-
const isDirectSound = ['audio', 'video'].includes(ownInfo.kind)
|
|
1134
|
-
const isReplyToSound = !bodyText && ['audio', 'video'].includes(quotedInfo.kind)
|
|
1135
|
-
|
|
1136
|
-
if (!isDirectSound && !isReplyToSound) return false
|
|
1137
|
-
|
|
1138
|
-
const client = extra.conn || extra.sock || m.conn || global.conn || global.sock
|
|
1139
|
-
if (!client) return false
|
|
1140
|
-
|
|
1141
|
-
const send = getReplyFunction(m, client)
|
|
1142
|
-
const targetNode = isDirectSound ? m : m.quoted
|
|
1143
|
-
const targetInfo = isDirectSound ? ownInfo : quotedInfo
|
|
1144
|
-
|
|
1145
|
-
await consumeSessionWithMedia(
|
|
1146
|
-
m,
|
|
1147
|
-
client,
|
|
1148
|
-
send,
|
|
1149
|
-
session,
|
|
1150
|
-
targetNode,
|
|
1151
|
-
targetInfo
|
|
1152
|
-
)
|
|
1153
|
-
|
|
1154
|
-
return true
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
handler.command = [
|
|
1158
|
-
'audiosticker',
|
|
1159
|
-
'stikeraudio',
|
|
1160
|
-
'stickeraudio',
|
|
1161
|
-
'figurinhasom',
|
|
1162
|
-
'saudio'
|
|
1163
|
-
]
|
|
1164
|
-
|
|
1165
|
-
handler.help = ['audiosticker [paquete|autor]']
|
|
1166
|
-
handler.tags = ['stickers']
|
|
1167
|
-
handler.description = 'Crea stickers de WhatsApp con audio a partir de fotos y videos.'
|
|
1168
|
-
handler.limit = true
|
|
1169
|
-
|
|
1170
|
-
export default handler
|