Skip to main content

DiscordConfig

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: bool

Whether 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: String

Discord 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: bool

When 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: bool

When true, process messages from other bots (not just humans). The bot still ignores its own messages to prevent feedback loops.

§interrupt_on_new_message: bool

When 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: bool

When true, only respond to messages that @-mention the bot. Other messages in the guild are silently ignored.

§slash_commands: bool

When 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: SlashCommandScope

Scope 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: StreamMode

Streaming 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: u64

Minimum interval (ms) between draft message edits to avoid rate limits. Only used when stream_mode = "partial".

§multi_message_delay_ms: u64

Delay (ms) between sending each message chunk in multi-message mode. Only used when stream_mode = "multi_message".

§stall_timeout_secs: u64

Stall-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: DiscordReactionScope

Which 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: u64

Seconds 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: u64

Per-(channel, recipient) outbound pacing floor in seconds. Range: 0..=REPLY_MIN_INTERVAL_MAX_SECS (0 disables).

§reply_queue_depth_max: u16

Per-(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

Source

pub fn configurable_prefix() -> &'static str

Returns the #[prefix] value for this Configurable struct.

Source

pub fn secret_fields(&self) -> Vec<SecretFieldInfo>

Returns metadata about all #[secret] fields on this struct and nested children.

Source

pub fn secret_field_terminals() -> Vec<&'static str>

Source

pub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>

Encrypt all secret fields in place using the provided store.

Source

pub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>

Decrypt all secret fields in place using the provided store.

Source

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.

Source

pub fn prop_fields(&self) -> Vec<PropFieldInfo>

Returns metadata about all property fields on this struct and nested children.

Source

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.

Source

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.

Source

pub fn prop_is_secret(name: &str) -> bool

Check if a property name refers to a secret field (static, no instance needed).

Source

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.

Source

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.

Source

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.

Source

pub fn nested_section_group(name: &str) -> Option<&'static str>

Source

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.

Source

pub fn nested_option_entries(&self) -> Vec<NestedOptionEntry>

Source

pub fn create_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>

Source

pub fn delete_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>

Source

pub fn rename_map_key( &mut self, section_path: &str, map_key: &str, new_key: &str, ) -> Result<bool, String>

Source§

impl DiscordConfig

Source

pub fn validate_bot_token(&self, alias: &str) -> Result<(), Error>

Validate this alias’s bot-token placeholder and enabled-state rules. Mirrors TelegramConfig::validate_bot_token.

Trait Implementations§

Source§

impl ChannelConfig for DiscordConfig

Source§

fn name() -> &'static str

human-readable name
Source§

fn desc() -> &'static str

short description
Source§

impl Clone for DiscordConfig

Source§

fn clone(&self) -> DiscordConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · §

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiscordConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for DiscordConfig

Source§

fn default() -> DiscordConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DiscordConfig

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<DiscordConfig, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl HasReplyPacing for DiscordConfig

Source§

impl JsonSchema for DiscordConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl MaskSecrets for DiscordConfig

Source§

impl Serialize for DiscordConfig

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,