diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index 79f52deb..1002fa5e 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -853,7 +853,8 @@ MyMesh::MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMe _cli_rescue = false; offline_queue_len = 0; app_target_ver = 0; - _bot_last_reply_ms = 0; + _bot_last_dm_reply_ms = 0; + _bot_last_ch_reply_ms = 0; _next_auto_advert_ms = 0; clearPendingReqs(); next_ack_idx = 0; diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index ec8a56b1..e6160a16 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -234,7 +234,8 @@ private: uint8_t *sign_data; uint32_t sign_data_len; unsigned long dirty_contacts_expiry; - unsigned long _bot_last_reply_ms; + unsigned long _bot_last_dm_reply_ms; + unsigned long _bot_last_ch_reply_ms; unsigned long _next_auto_advert_ms; TransportKey send_scope; diff --git a/examples/companion_radio/MyMeshBot.h b/examples/companion_radio/MyMeshBot.h index 701ffeab..5c892164 100644 --- a/examples/companion_radio/MyMeshBot.h +++ b/examples/companion_radio/MyMeshBot.h @@ -5,7 +5,7 @@ void MyMesh::tryBotReplyDM(const ContactInfo& from, const char* text) { if (from.type != ADV_TYPE_CHAT) return; if (!(_prefs.bot_enabled && _prefs.bot_trigger[0] && _prefs.bot_reply_dm[0] && - millis() - _bot_last_reply_ms > 10000UL)) + millis() - _bot_last_dm_reply_ms > 10000UL)) return; const char* tr = _prefs.bot_trigger; @@ -27,7 +27,7 @@ void MyMesh::tryBotReplyDM(const ContactInfo& from, const char* text) { &sensors, (float)board.getBattMilliVolts() / 1000.0f); uint32_t expected_ack, est_timeout; if (sendMessage(from, ts, 0, expanded, expected_ack, est_timeout) != MSG_SEND_FAILED) { - _bot_last_reply_ms = millis(); + _bot_last_dm_reply_ms = millis(); #ifdef DISPLAY_CLASS if (_ui) _ui->addDMMsg(from.id.pub_key, true, expanded); #endif @@ -37,7 +37,7 @@ void MyMesh::tryBotReplyDM(const ContactInfo& from, const char* text) { void MyMesh::tryBotReplyChannel(uint8_t channel_idx, const char* text) { if (!(_prefs.bot_channel_enabled && _prefs.bot_trigger[0] && _prefs.bot_reply_ch[0] && channel_idx == _prefs.bot_channel_idx && - millis() - _bot_last_reply_ms > 10000UL)) + millis() - _bot_last_ch_reply_ms > 10000UL)) return; // Skip "sender_name: " prefix so the trigger is only matched against the message body. @@ -67,7 +67,7 @@ void MyMesh::tryBotReplyChannel(uint8_t channel_idx, const char* text) { &sensors, (float)board.getBattMilliVolts() / 1000.0f); int rlen = strlen(expanded); if (sendGroupMessage(ts, ch.channel, _prefs.node_name, expanded, rlen)) { - _bot_last_reply_ms = millis(); + _bot_last_ch_reply_ms = millis(); #ifdef DISPLAY_CLASS if (_ui) { char with_sender[240]; // node_name(32) + ": "(2) + expanded(200) + margin