Struct DiscordConfig
pub struct DiscordConfig {Show 21 fields
pub enabled: bool,
pub bot_token: String,
pub guild_ids: Vec<String>,
pub channel_ids: Vec<String>,
pub archive: bool,
pub listen_to_bots: bool,
pub interrupt_on_new_message: bool,
pub mention_only: bool,
pub slash_commands: bool,
pub slash_command_scope: SlashCommandScope,
pub proxy_url: Option<String>,
pub stream_mode: StreamMode,
pub draft_update_interval_ms: u64,
pub multi_message_delay_ms: u64,
pub stall_timeout_secs: u64,
pub intents_mask: Option<u64>,
pub reaction_notifications: DiscordReactionScope,
pub approval_timeout_secs: u64,
pub excluded_tools: Vec<String>,
pub reply_min_interval_secs: u64,
pub reply_queue_depth_max: u16,
}Expand description
Discord bot channel configuration.
Fields§
§enabled: boolWhether this channel is active. The runtime only loads channels whose
enabled = true. Default: false so an operator who pastes a partial
[channels.<type>.<alias>] block doesn’t accidentally bring a channel
live before the rest of its config is filled in.
bot_token: StringDiscord bot token (from Discord Developer Portal). #[serde(default)]
for the same reason as TelegramConfig::bot_token: a missing token
must deserialize as an empty string instead of salvage-dropping the
alias; validate_bot_token still requires a real token once
enabled = true.
guild_ids: Vec<String>Guild (server) IDs to restrict the bot to. Empty = listen across all
guilds the bot is invited to. Migrated from the legacy guild_id
singular field.
channel_ids: Vec<String>Channel IDs to watch. Empty = watch every channel the bot can see.
Used by the archive sidecar (when archive = true) and by the
in-channel filter when set.
archive: boolWhen true, the channel opens a sidecar discord.db SQLite memory
backend, archives every non-bot message it sees, and registers the
discord_search tool against it. Default: false. Folded in from
the legacy [channels.discord-history] block.
listen_to_bots: boolWhen true, process messages from other bots (not just humans). The bot still ignores its own messages to prevent feedback loops.
interrupt_on_new_message: boolWhen true, a newer Discord message from the same sender in the same channel cancels the in-flight request and starts a fresh response with preserved history.
mention_only: boolWhen true, only respond to messages that @-mention the bot. Other messages in the guild are silently ignored.
slash_commands: boolWhen true, register and serve Discord slash commands (e.g. /ask)
over the Gateway WebSocket, in addition to message handling. Default
false. (Prototype: currently registers a single /ask <prompt>.)
slash_command_scope: SlashCommandScopeScope for registered slash commands: global (default, application-wide,
~1h propagation) or guild (registered to each guild_ids entry,
instant). Only meaningful when slash_commands = true; guild with an
empty guild_ids warns and falls back to global. Switching scope reaps
owned commands from the now-inactive scope; note that removing a guild
from guild_ids (without switching scope) does not reap that guild’s
commands - remove the bot from the guild, or switch scope, to clear them.
proxy_url: Option<String>Per-channel proxy URL (http, https, socks5, socks5h).
Overrides the global [proxy] setting for this channel only.
stream_mode: StreamModeStreaming mode for progressive response delivery.
off (default): single message. partial: editable draft updates.
multi_message: split response into separate messages at paragraph boundaries.
draft_update_interval_ms: u64Minimum interval (ms) between draft message edits to avoid rate limits.
Only used when stream_mode = "partial".
multi_message_delay_ms: u64Delay (ms) between sending each message chunk in multi-message mode.
Only used when stream_mode = "multi_message".
stall_timeout_secs: u64Stall-watchdog timeout in seconds. When non-zero, the bot will abort and retry if no progress is made within this duration. 0 = disabled.
intents_mask: Option<u64>Raw gateway intent mask override. When set, this exact value is sent in IDENTIFY instead of the derived mask: an operator escape hatch for downstream deployments that consume gateway events through custom builds or forks. The operator owns the consequences: privileged bits still need their Developer Portal toggles, and dropping baseline bits silences message handling (a warning is logged). Unset (default) = derive the mask from the channel’s feature config.
reaction_notifications: DiscordReactionScopeWhich inbound reactions to record: off (default: reaction events
are not even requested from the gateway), own (reactions to the
bot’s messages), or all (reactions to any message passing the
channel’s filters). Recorded reactions are archived to discord.db
when archive is enabled, and removed again when a user removes
their reaction (bulk clears, remove-all / remove-emoji, are not
yet swept). A set intents_mask overrides the derived mask: if it
omits the reaction intents, nothing is recorded.
approval_timeout_secs: u64Seconds to wait for operator approval on always_ask tools before auto-denying.
excluded_tools: Vec<String>Tools excluded from this channel’s tool spec. When set, these tools are not exposed to the model when responding via this channel.
reply_min_interval_secs: u64Per-(channel, recipient) outbound pacing floor in seconds.
Range: 0..=REPLY_MIN_INTERVAL_MAX_SECS (0 disables).
reply_queue_depth_max: u16Per-(channel, recipient) outbound pacing queue depth.
Range: 0..=REPLY_QUEUE_DEPTH_CEILING. When reply_min_interval_secs > 0
and this value is 0, the pacing wrapper substitutes
DEFAULT_REPLY_QUEUE_DEPTH (16). When the queue is full, the
newest send is dropped and a WARN is logged.
Implementations§
Source§impl DiscordConfig
impl DiscordConfig
Sourcepub fn configurable_prefix() -> &'static str
pub fn configurable_prefix() -> &'static str
Returns the #[prefix] value for this Configurable struct.
Sourcepub fn secret_fields(&self) -> Vec<SecretFieldInfo>
pub fn secret_fields(&self) -> Vec<SecretFieldInfo>
Returns metadata about all #[secret] fields on this struct and nested children.
pub fn secret_field_terminals() -> Vec<&'static str>
Sourcepub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
pub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
Encrypt all secret fields in place using the provided store.
Sourcepub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
pub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>
Decrypt all secret fields in place using the provided store.
Sourcepub fn set_secret(&mut self, name: &str, value: String) -> Result<(), Error>
pub fn set_secret(&mut self, name: &str, value: String) -> Result<(), Error>
Set a secret field by its full dotted name, dispatching to nested children.
Sourcepub fn prop_fields(&self) -> Vec<PropFieldInfo>
pub fn prop_fields(&self) -> Vec<PropFieldInfo>
Returns metadata about all property fields on this struct and nested children.
Sourcepub fn get_prop(&self, name: &str) -> Result<String, Error>
pub fn get_prop(&self, name: &str) -> Result<String, Error>
Get a property value by its full dotted name, returning it as a display string.
Sourcepub fn set_prop(&mut self, name: &str, value_str: &str) -> Result<(), Error>
pub fn set_prop(&mut self, name: &str, value_str: &str) -> Result<(), Error>
Set a property value by its full dotted name, parsing from string.
Sourcepub fn prop_is_secret(name: &str) -> bool
pub fn prop_is_secret(name: &str) -> bool
Check if a property name refers to a secret field (static, no instance needed).
Sourcepub fn init_defaults(&mut self, prefix: Option<&str>) -> Vec<&'static str>
pub fn init_defaults(&mut self, prefix: Option<&str>) -> Vec<&'static str>
Instantiate None nested sections whose prefix matches.
Returns the prefixes that were initialized.
Sourcepub fn map_key_sections() -> Vec<MapKeySection>
pub fn map_key_sections() -> Vec<MapKeySection>
Enumerate every map-keyed (HashMap<String, T>) and list-shaped
(Vec<T>) section discoverable from this Configurable’s tree.
The dashboard / CLI consume this to surface “+ Add” affordances
without hardcoding the section list.
Sourcepub fn nested_section_help(name: &str) -> Option<&'static str>
pub fn nested_section_help(name: &str) -> Option<&'static str>
Help blurb for a #[nested] field on this struct, sourced from
the field-level /// docstring. Returns None for unknown
names so callers can fall through to a different lookup.
pub fn nested_section_group(name: &str) -> Option<&'static str>
Sourcepub fn get_map_keys(&self, section_path: &str) -> Option<Vec<String>>
pub fn get_map_keys(&self, section_path: &str) -> Option<Vec<String>>
Return the current alias keys at section_path, or None if
the path doesn’t resolve to a map-keyed section in this tree.
pub fn nested_option_entries(&self) -> Vec<NestedOptionEntry>
pub fn create_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>
pub fn delete_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>
pub fn rename_map_key( &mut self, section_path: &str, map_key: &str, new_key: &str, ) -> Result<bool, String>
Source§impl DiscordConfig
impl DiscordConfig
Trait Implementations§
Source§impl ChannelConfig for DiscordConfig
impl ChannelConfig for DiscordConfig
Source§impl Clone for DiscordConfig
impl Clone for DiscordConfig
Source§fn clone(&self) -> DiscordConfig
fn clone(&self) -> DiscordConfig
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiscordConfig
impl Debug for DiscordConfig
Source§impl Default for DiscordConfig
impl Default for DiscordConfig
Source§fn default() -> DiscordConfig
fn default() -> DiscordConfig
Source§impl<'de> Deserialize<'de> for DiscordConfig
impl<'de> Deserialize<'de> for DiscordConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DiscordConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DiscordConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl HasReplyPacing for DiscordConfig
impl HasReplyPacing for DiscordConfig
fn reply_min_interval_secs(&self) -> u64
fn reply_queue_depth_max(&self) -> u16
Source§impl JsonSchema for DiscordConfig
impl JsonSchema for DiscordConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl MaskSecrets for DiscordConfig
impl MaskSecrets for DiscordConfig
fn mask_secrets(&mut self)
fn restore_secrets_from(&mut self, current: &DiscordConfig)
Source§impl Serialize for DiscordConfig
impl Serialize for DiscordConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for DiscordConfig
impl RefUnwindSafe for DiscordConfig
impl Send for DiscordConfig
impl Sync for DiscordConfig
impl Unpin for DiscordConfig
impl UnsafeUnpin for DiscordConfig
impl UnwindSafe for DiscordConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more