@roidev/kachina-md 2.1.6 → 2.1.7
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/lib/client/Client.js +1 -3
- package/lib/helpers/serialize.js +5 -4
- package/package.json +1 -1
package/lib/client/Client.js
CHANGED
|
@@ -188,15 +188,13 @@ export class Client extends EventEmitter {
|
|
|
188
188
|
this.sock.ev.on('messages.upsert', async ({ messages, type }) => {
|
|
189
189
|
if (type !== 'notify') return;
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
const m = await serialize(message, this.sock);
|
|
191
|
+
const m = await serialize(messages, this.sock);
|
|
193
192
|
this.emit('message', m);
|
|
194
193
|
|
|
195
194
|
// Auto plugin handler
|
|
196
195
|
if (this.pluginHandler.isLoaded && m.body?.startsWith(this.config.prefix || '!')) {
|
|
197
196
|
await this.pluginHandler.execute(m);
|
|
198
197
|
}
|
|
199
|
-
}
|
|
200
198
|
});
|
|
201
199
|
|
|
202
200
|
this.sock.ev.on('group-participants.update', (update) => {
|
package/lib/helpers/serialize.js
CHANGED
|
@@ -29,7 +29,7 @@ import { fileTypeFromBuffer } from 'file-type';
|
|
|
29
29
|
/**
|
|
30
30
|
* Serialize raw Baileys message into standardized format with helper methods
|
|
31
31
|
* @async
|
|
32
|
-
* @param {import('baileys').WAMessage}
|
|
32
|
+
* @param {import('baileys').WAMessage[]} messages - Raw Baileys message object
|
|
33
33
|
* @param {Object} sock - WhatsApp socket instance
|
|
34
34
|
* @returns {Promise<SerializedMessage>} Serialized message object
|
|
35
35
|
* @example
|
|
@@ -38,8 +38,9 @@ import { fileTypeFromBuffer } from 'file-type';
|
|
|
38
38
|
* await m.reply('Hello!'); // Reply to message
|
|
39
39
|
* await m.react('👍'); // React with emoji
|
|
40
40
|
*/
|
|
41
|
-
export async function serialize(
|
|
42
|
-
msg =
|
|
41
|
+
export async function serialize(messages, sock) {
|
|
42
|
+
let msg = messages[0];
|
|
43
|
+
|
|
43
44
|
if (!msg) return null;
|
|
44
45
|
const m = {};
|
|
45
46
|
|
|
@@ -68,7 +69,7 @@ export async function serialize(msg, sock) {
|
|
|
68
69
|
remoteJid: m.chat,
|
|
69
70
|
fromMe: msg.message[type].contextInfo.participant === sock.user.id,
|
|
70
71
|
id: msg.message[type].contextInfo.stanzaId,
|
|
71
|
-
participant: m.isGroup ? m.key
|
|
72
|
+
participant: m.isGroup ? m.key?.participantLid : m.key?.participant
|
|
72
73
|
},
|
|
73
74
|
message: quoted,
|
|
74
75
|
pushName: msg.message[type].contextInfo.pushName || ''
|