From cb24d0b3fec4c983320162dd0e080fc05709ae55 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 14 Dec 2024 00:14:51 +0500 Subject: upd: markov response chance --- bot/src/constants.hpp | 2 ++ bot/src/handlers.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'bot/src') diff --git a/bot/src/constants.hpp b/bot/src/constants.hpp index 3c3462b..b72a4c6 100644 --- a/bot/src/constants.hpp +++ b/bot/src/constants.hpp @@ -11,3 +11,5 @@ const std::string DEFAULT_PREFIX = "~"; const std::string DEFAULT_PREFIX = "!"; #endif const auto START_TIME = std::chrono::steady_clock::now(); + +#define MARKOV_RESPONSE_CHANCE 1 \ No newline at end of file diff --git a/bot/src/handlers.cpp b/bot/src/handlers.cpp index c57edad..7589e0b 100644 --- a/bot/src/handlers.cpp +++ b/bot/src/handlers.cpp @@ -12,6 +12,7 @@ #include "commands/command.hpp" #include "commands/request.hpp" #include "commands/request_util.hpp" +#include "constants.hpp" #include "cpr/api.h" #include "cpr/multipart.h" #include "cpr/response.h" @@ -125,10 +126,10 @@ namespace bot::handlers { std::random_device dev; std::mt19937 rng(dev()); - std::uniform_int_distribution dist(0, 10); + std::uniform_int_distribution dist(0, 100); random = dist(rng); - if (random != 0) return; + if (random > MARKOV_RESPONSE_CHANCE) return; question = message.message; } else { question = -- cgit v1.2.3