From 64b35666b5f8cf05537edcce4a51f65afcdf8098 Mon Sep 17 00:00:00 2001 From: Melvin Jones Repol Date: Sat, 20 Jan 2024 22:43:37 +0800 Subject: [PATCH] Initial Commit --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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);