@roidev/kachina-md 2.1.7 → 2.1.8
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
CHANGED
|
@@ -76,7 +76,7 @@ export class Client extends EventEmitter {
|
|
|
76
76
|
this.config = {
|
|
77
77
|
sessionId: options.sessionId || 'kachina-session',
|
|
78
78
|
phoneNumber: options.phoneNumber || '',
|
|
79
|
-
|
|
79
|
+
owners: options.owners || [],
|
|
80
80
|
loginMethod: options.loginMethod || 'qr', // 'qr' or 'pairing'
|
|
81
81
|
browser: options.browser || ['Kachina-MD', 'Chrome', '1.0.0'],
|
|
82
82
|
logger: options.logger || pino({ level: 'silent' }),
|
|
@@ -234,18 +234,18 @@ export class PluginHandler {
|
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* Check if user is bot owner
|
|
237
|
-
* @param {string}
|
|
237
|
+
* @param {string} lid - User JID to check
|
|
238
238
|
* @returns {boolean} True if user is owner
|
|
239
239
|
* @example
|
|
240
240
|
* if (handler.isOwner(m.sender)) {
|
|
241
241
|
* // Owner-only logic
|
|
242
242
|
* }
|
|
243
243
|
*/
|
|
244
|
-
isOwner(
|
|
245
|
-
const owners = this.client.config.owners ||
|
|
244
|
+
isOwner(lid) {
|
|
245
|
+
const owners = this.client.config.owners || [];
|
|
246
246
|
const ownerList = Array.isArray(owners) ? owners : [owners];
|
|
247
|
-
const number =
|
|
248
|
-
return ownerList.includes(number) || ownerList.includes(
|
|
247
|
+
const number = lid.split('@')[0];
|
|
248
|
+
return ownerList.includes(number) || ownerList.includes(lid);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
/**
|
package/lib/helpers/serialize.js
CHANGED
|
@@ -64,16 +64,16 @@ export async function serialize(messages, sock) {
|
|
|
64
64
|
// Get quoted message
|
|
65
65
|
const quoted = msg.message?.[type]?.contextInfo?.quotedMessage;
|
|
66
66
|
if (quoted) {
|
|
67
|
-
m.quoted = await serialize({
|
|
67
|
+
m.quoted = await serialize([{
|
|
68
68
|
key: {
|
|
69
69
|
remoteJid: m.chat,
|
|
70
70
|
fromMe: msg.message[type].contextInfo.participant === sock.user.id,
|
|
71
71
|
id: msg.message[type].contextInfo.stanzaId,
|
|
72
|
-
participant: m.isGroup ? m.key
|
|
72
|
+
participant: m.isGroup ? m.key.participantLid : m.key.participant
|
|
73
73
|
},
|
|
74
74
|
message: quoted,
|
|
75
75
|
pushName: msg.message[type].contextInfo.pushName || ''
|
|
76
|
-
}, sock);
|
|
76
|
+
}], sock);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// Media info
|