diff --git a/index.js b/index.js index 3995c6d2..710b98ca 100644 --- a/index.js +++ b/index.js @@ -6571,8 +6571,12 @@ async function sendMessageOnly(api, event, message, thread_id, message_id, bn, v async function sendMMMS(api, message, thread_id, message_id, id, voiceE, no_font, sendMessageOnly) { getUserProfile(id, async function (user) { - let countTokens = countWords(message) + countVowel(message) + countConsonants(message); - addBalance(user, countTokens); + let splitNewLines = message.split("\n"); + splitNewLines.shift(); + splitNewLines.pop(); + splitNewLines = splitNewLines.join(" "); + let countTokens = countWords(splitNewLines) + countVowel(splitNewLines) + countConsonants(splitNewLines); + addBalance(user, (countTokens / 3)); }); if (voiceE && typeof message === "string" && message.length < 200 && groups.tts.includes(thread_id)) { const url = GoogleTTS.getAudioUrl(message, voiceOptions);