From ddac41968707f6f5bc4c6529247d871b046b5e5c Mon Sep 17 00:00:00 2001 From: Matthieu Pignolet Date: Thu, 6 Jun 2024 14:21:03 +0400 Subject: [PATCH] make the bot reply less often --- autofeur_db/src/trie.rs | 4 ++-- discordjs/src/index.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autofeur_db/src/trie.rs b/autofeur_db/src/trie.rs index 1788d52..2359d2d 100644 --- a/autofeur_db/src/trie.rs +++ b/autofeur_db/src/trie.rs @@ -109,14 +109,14 @@ impl<'a> Trie<'a> { while current_node.child_nodes.len() != 0 { // We need to choose a random child based on weights let weighted = WeightedIndex::new(current_node.child_nodes.iter().map(|(_, node)| { - (node.child_count + node.child_count / (node .child_nodes .iter() .map(|(_, b)| b.child_count) .sum::() + 1) - + 1) + + 1 })) .expect("distribution creation should be valid"); diff --git a/discordjs/src/index.mjs b/discordjs/src/index.mjs index c28c65d..00cec61 100644 --- a/discordjs/src/index.mjs +++ b/discordjs/src/index.mjs @@ -46,7 +46,7 @@ client.on("messageCreate", async (message) => { let response = await completeWord(cutWord(message.cleanContent)); // Ignore if there is no completion - if ((response || response === "") && Math.random() > 0.6) { + if ((response || response === "") && Math.random() > 0.8) { message.reply(response); } } catch (e) { -- 2.39.5