Skip to content

Commit 00a70b3

Browse files
committed
fix(chatbot): improve LID detection using endsWith instead of includes
- Replace includes('@lid') with endsWith('@lid') for more accurate LID detection - Prevent false positives from JIDs containing '@lid' substring in the middle - Apply fix to audioWhatsapp, mediaMessage, and textMessage methods - Ensure only true LID JIDs are handled specially - Improve code reliability and prevent potential bugs with malformed JIDs
1 parent 1f83b47 commit 00a70b3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/api/integrations/chatbot/base-chatbot.service.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ export abstract class BaseChatbotService<BotType = any, SettingsType = any> {
211211
try {
212212
if (mediaType === 'audio') {
213213
await instance.audioWhatsapp({
214-
number: remoteJid.split('@')[0],
214+
number: remoteJid.endsWith('@lid') ? remoteJid : remoteJid.split('@')[0],
215215
delay: (settings as any)?.delayMessage || 1000,
216216
audio: url,
217217
caption: altText,
218218
});
219219
} else {
220220
await instance.mediaMessage(
221221
{
222-
number: remoteJid.split('@')[0],
222+
number: remoteJid.endsWith('@lid') ? remoteJid : remoteJid.split('@')[0],
223223
delay: (settings as any)?.delayMessage || 1000,
224224
mediatype: mediaType,
225225
media: url,
@@ -290,7 +290,7 @@ export abstract class BaseChatbotService<BotType = any, SettingsType = any> {
290290
setTimeout(async () => {
291291
await instance.textMessage(
292292
{
293-
number: remoteJid.split('@')[0],
293+
number: remoteJid.endsWith('@lid') ? remoteJid : remoteJid.split('@')[0],
294294
delay: settings?.delayMessage || 1000,
295295
text: message,
296296
linkPreview,

0 commit comments

Comments
 (0)