feat(discord): add mention_only config for @-mention trigger (#529)
When mention_only is true, the bot only responds to messages that @-mention the bot. Other messages in the guild are silently ignored. Also strips the bot mention from content before processing. Co-authored-by: Will Sarg <12886992+willsarg@users.noreply.github.com>
This commit is contained in:
parent
a2986db3d6
commit
5b5d9fe77f
6 changed files with 56 additions and 14 deletions
|
|
@ -1319,6 +1319,10 @@ pub struct DiscordConfig {
|
|||
/// The bot still ignores its own messages to prevent feedback loops.
|
||||
#[serde(default)]
|
||||
pub listen_to_bots: bool,
|
||||
/// When true, only respond to messages that @-mention the bot.
|
||||
/// Other messages in the guild are silently ignored.
|
||||
#[serde(default)]
|
||||
pub mention_only: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
@ -2392,6 +2396,7 @@ tool_dispatcher = "xml"
|
|||
guild_id: Some("12345".into()),
|
||||
allowed_users: vec![],
|
||||
listen_to_bots: false,
|
||||
mention_only: false,
|
||||
};
|
||||
let json = serde_json::to_string(&dc).unwrap();
|
||||
let parsed: DiscordConfig = serde_json::from_str(&json).unwrap();
|
||||
|
|
@ -2406,6 +2411,7 @@ tool_dispatcher = "xml"
|
|||
guild_id: None,
|
||||
allowed_users: vec![],
|
||||
listen_to_bots: false,
|
||||
mention_only: false,
|
||||
};
|
||||
let json = serde_json::to_string(&dc).unwrap();
|
||||
let parsed: DiscordConfig = serde_json::from_str(&json).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue