mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 02:36:11 +00:00
feat(bot): hardening + auto-responder, query commands, quiet hours
Reply-bot overhaul on top of the trigger/reply auto-reply: Robustness - single botTriggerMatches() shared by DM/channel paths; named constants (BOT_REPLY_COOLDOWN_MS / BOT_SCRATCH) replace magic numbers. - per-contact DM throttle (8-entry ring) so a second sender isn't starved while one contact is on cooldown. - channel anti-loop: skip only when an incoming message equals our own reply (was: any reply containing the trigger word — which silently killed channel replies for the common "trigger word in reply" setup). Features - away / reply-to-all: a lone "*" trigger matches every message. - independent DM vs channel triggers (bot_trigger / bot_trigger_ch); "*" works on the channel too, bounded by cooldown + echo guard. - query commands: a DM or monitored-channel message is scanned for "!word" tokens — !ping/!batt/!loc/!time/!temp/!hops/!status/!help — merged into one combined reply. DM = per-contact throttle, ignores quiet hours; channel = broadcast, per-channel cooldown, respects quiet hours. !hops uses getPathHashCount() (0 = direct). - quiet hours (bot_quiet_start/end, local, wraps midnight) silence push replies. - reply counter shown in the BotScreen header. UI / storage - BotScreen: 9 rows, scrolling list (no more cramming), field I/O via fieldBuf()/fieldCap(). - prefs bot_commands_enabled / bot_quiet_start / bot_quiet_end / bot_trigger_ch persisted; schema 0xC0DE000A → 0xC0DE000C with clamping + migration (bot_trigger_ch seeded from bot_trigger on upgrade). - docs: tools_screen bot section rewritten; FEATURES.md refreshed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8c0ccaed73
commit
8bd6fbf1cb
@@ -57,9 +57,13 @@ struct NodePrefs { // persisted to file
|
||||
uint8_t bot_enabled; // 0=disabled, 1=DM bot active (responds to all DMs)
|
||||
uint8_t bot_channel_enabled; // 0=disabled, 1=channel bot active for bot_channel_idx
|
||||
uint8_t bot_channel_idx; // channel index for channel bot
|
||||
char bot_trigger[64]; // trigger phrase (case-insensitive contains match)
|
||||
char bot_trigger[64]; // DM trigger phrase (case-insensitive contains; "*" = any DM)
|
||||
char bot_reply_dm[140]; // auto-reply text for DM
|
||||
char bot_reply_ch[140]; // auto-reply text for channel
|
||||
char bot_trigger_ch[64]; // channel trigger phrase (independent of DM; "*" = any channel msg)
|
||||
uint8_t bot_commands_enabled; // 0=off, 1=answer !ping/!batt/!loc/!time/!help DM commands
|
||||
uint8_t bot_quiet_start; // quiet-hours start hour, local 0-23 (start==end → disabled)
|
||||
uint8_t bot_quiet_end; // quiet-hours end hour, local 0-23
|
||||
uint8_t clock_hide_seconds; // 0=show HH:MM:SS/refresh 1s (default), 1=hide/refresh 60s
|
||||
uint8_t clock_12h; // 0=24h (default), 1=12h with AM/PM
|
||||
uint8_t buzzer_auto; // 0=manual (default), 1=auto-mute when BT connected
|
||||
@@ -140,7 +144,7 @@ struct NodePrefs { // persisted to file
|
||||
// adding/removing/reordering fields in DataStore::savePrefs/loadPrefsInt so
|
||||
// older saves are detected on load and skipped (zero-init defaults kept).
|
||||
// High 24 bits identify the file format; low byte is the schema revision.
|
||||
static const uint32_t SCHEMA_SENTINEL = 0xC0DE000A;
|
||||
static const uint32_t SCHEMA_SENTINEL = 0xC0DE000C;
|
||||
|
||||
// Bit-index for each home page. Used by page_order (entries store bit+1) and
|
||||
// by home_pages_mask. Single source of truth — both HomeScreen::pageBit/bitToPage
|
||||
|
||||
Reference in New Issue
Block a user