summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Pignolet <matthieu@matthieu-dev.xyz>2024-06-06 14:21:03 +0400
committerMatthieu Pignolet <matthieu@matthieu-dev.xyz>2024-06-06 14:21:03 +0400
commitddac41968707f6f5bc4c6529247d871b046b5e5c (patch)
tree9fdf1e13322f681d102c93830446b0c4a0c530e2
parent7698cd57a9db15aaf5d2f13affb001b4832033a4 (diff)
make the bot reply less often
-rw-r--r--autofeur_db/src/trie.rs4
-rw-r--r--discordjs/src/index.mjs2
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::<u64>()
+ 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) {