]> git.puffer.fish Git - matthieu/gru.git/commitdiff
make the bot reply less often
authorMatthieu Pignolet <matthieu@matthieu-dev.xyz>
Thu, 6 Jun 2024 10:21:03 +0000 (14:21 +0400)
committerMatthieu Pignolet <matthieu@matthieu-dev.xyz>
Thu, 6 Jun 2024 10:21:03 +0000 (14:21 +0400)
autofeur_db/src/trie.rs
discordjs/src/index.mjs

index 1788d527fa58a9b078ec80b42024001107a2bb17..2359d2deedb3af07bfa773118f629fb4c69eab0f 100644 (file)
@@ -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");
 
index c28c65d0c920fad47483d5cefebabb4907f41c8c..00cec618cd8e6d97664bfc72f79fbba6455640f6 100644 (file)
@@ -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) {