Bot: add DM contact target alongside channel

The bot can now reply to a specific DM contact instead of a channel.

UI (BotScreen): item 1 cycles through all channels followed by all DM
contacts (ADV_TYPE_CHAT). The label switches between "Channel" / "Contact"
and the value shows the channel or contact name. Left/right/enter navigate
the combined list.

Logic (MyMesh::onMessageRecv): when bot_target_type==1, match the trigger
against incoming DM text and reply via sendMessage(). A 4-byte pubkey
prefix identifies the target; all-zero prefix matches any DM sender.

Persistence: bot_target_type and bot_dm_pubkey[4] appended to prefs with
backward-compat read guard (old firmware defaults to channel mode).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-13 21:09:47 +02:00
co-authored by Claude Sonnet 4.6
parent 9756bb062c
commit e638955898
4 changed files with 109 additions and 19 deletions
+3 -1
View File
@@ -50,7 +50,9 @@ struct NodePrefs { // persisted to file
uint8_t ringtone_notes[32]; // packed: bits0-2=pitch, bits3-4=octave-4, bits5-6=dur_idx
uint16_t home_pages_mask; // bitmask of visible home pages (bit0=Clock..bit8=Shutdown); 0=all visible
uint8_t bot_enabled; // 0=disabled, 1=enabled
uint8_t bot_channel_idx; // channel index to monitor
uint8_t bot_channel_idx; // channel index to monitor (when bot_target_type==0)
char bot_trigger[64]; // trigger phrase (case-insensitive contains match)
char bot_reply[140]; // auto-reply text
uint8_t bot_target_type; // 0=channel (default), 1=DM contact
uint8_t bot_dm_pubkey[4]; // pubkey prefix of DM target; all-zero = any DM sender
};