From: Matthieu Pignolet Date: Thu, 6 Jun 2024 10:38:15 +0000 (+0400) Subject: remove the ? and ! characters X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a5fbafbf18822640c9f2801fd69f0fcd10add89c;p=matthieu%2Fgru.git remove the ? and ! characters --- diff --git a/discordjs/src/index.mjs b/discordjs/src/index.mjs index 00cec61..73b5120 100644 --- a/discordjs/src/index.mjs +++ b/discordjs/src/index.mjs @@ -29,6 +29,9 @@ export const completeWord = (grapheme) => { */ const cutWord = (sentence) => { let lastWord = sentence + .replaceAll("?", "") + .replaceAll("!", "") + .trim() .split(" ") .slice(-1)[0] .replaceAll(/(\s)?([^\x41-\x5A\s^\x61-\x7A^\xC0-\xFF])/g, "") @@ -42,11 +45,11 @@ client.on("messageCreate", async (message) => { try { // Get the completed word found by the db. - + let response = await completeWord(cutWord(message.cleanContent)); // Ignore if there is no completion - if ((response || response === "") && Math.random() > 0.8) { + if ((response || response === "") && Math.random() > 0.95) { message.reply(response); } } catch (e) {