diff --git a/src/solanaceae/rpbot/rpbot.cpp b/src/solanaceae/rpbot/rpbot.cpp index 35246eb..dc29b86 100644 --- a/src/solanaceae/rpbot/rpbot.cpp +++ b/src/solanaceae/rpbot/rpbot.cpp @@ -307,7 +307,11 @@ bool RPBot::onEvent(const Message::Events::MessageConstruct& e) { auto& timeout = _cr.get(rpbot_contact).timeout; // TODO: config with id - timeout = std::min(timeout, _conf.get_double("RPBot", "max_interactive_delay").value_or(4.f)); + timeout = std::clamp( + timeout, + 1.5f, // minimum, helps when activly history syncing + _conf.get_double("RPBot", "max_interactive_delay").value_or(4.f) + ); std::cout << "RPBot: onMsg new timeout: " << timeout << "\n"; return false; diff --git a/src/solanaceae/rpbot/rpbot_commands.cpp b/src/solanaceae/rpbot/rpbot_commands.cpp index 23539a2..38ffc95 100644 --- a/src/solanaceae/rpbot/rpbot_commands.cpp +++ b/src/solanaceae/rpbot/rpbot_commands.cpp @@ -65,6 +65,14 @@ void RPBot::registerCommands(void) { auto view = _cr.view(); for (auto it = view.begin(), it_end = view.end(); it != it_end; it++) { if (view.get(*it).data == id_bin) { + if (_cr.any_of(*it)) { + _rmm.sendText( + contact_from, + "RPBot already running" + ); + return true; + } + auto& new_state = _cr.emplace(*it); new_state.timeout = 10.f;