From b63c4cd2eccaf66d46ec6ed37038ada5c8e079e6 Mon Sep 17 00:00:00 2001 From: "brobert (aider)" Date: Sun, 23 Mar 2025 23:49:35 +0100 Subject: [PATCH] fix: Change const to let in messaging utility to allow payload reassignment --- src/bot/utils/messaging.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/bot/utils/messaging.ts b/src/bot/utils/messaging.ts index 3873ee6..7d66200 100644 --- a/src/bot/utils/messaging.ts +++ b/src/bot/utils/messaging.ts @@ -14,13 +14,10 @@ if (!API_URL || !INSTANCE_NAME || !API_KEY) { // Send a message with optional mentions export async function sendMessage(phone: string, message: string, mentions: string[] = []) { try { - const payload: any = { - number: phone, - text: message, - }; - - // Add mentions if provided + let payload: any; + if (mentions.length > 0) { + // Format with mentions payload = { number: phone, options: { @@ -36,6 +33,12 @@ export async function sendMessage(phone: string, message: string, mentions: stri text: message } }; + } else { + // Simple message format + payload = { + number: phone, + text: message + }; } await axios.post(`${API_URL}/message/sendText/${INSTANCE_NAME}`, payload, {