Struct TelegramConfig
pub struct TelegramConfig {Show 17 fields
pub enabled: bool,
pub bot_token: String,
pub api_base_url: String,
pub stream_mode: StreamMode,
pub draft_update_interval_ms: u64,
pub multi_message_delay_ms: u64,
pub debounce_ms: Option<u64>,
pub interrupt_on_new_message: bool,
pub mention_only: bool,
pub per_user_session: bool,
pub passive_group_context: bool,
pub ack_reactions: Option<bool>,
pub proxy_url: Option<String>,
pub approval_timeout_secs: u64,
pub excluded_tools: Vec<String>,
pub reply_min_interval_secs: u64,
pub reply_queue_depth_max: u16,
}Expand description
Telegram 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: StringTelegram Bot API token (from @BotFather). #[serde(default)] so a
config that omits or later has it pruned (e.g. a freshly created
alias with an empty token, stripped by prune_empty_leaves before
write) still deserializes as an empty string - instead of failing
with missing field 'bot_token' and getting dropped by the resilient
salvage pass. validate_bot_token below still requires a real token
once enabled = true.
api_base_url: StringTelegram Bot API base URL. Defaults to the official Telegram endpoint; set to a local Bot API server URL when self-hosting Telegram’s bot API.
stream_mode: StreamModeStreaming mode for progressive response delivery via message edits.
draft_update_interval_ms: u64Minimum interval (ms) between draft message edits to avoid rate limits.
multi_message_delay_ms: u64Minimum delay (ms) between successive multi_message narration messages
(and before the approval prompt) for one recipient. Does not apply to the
fixed pacing between physical fragments of a single over-4096-character
message. Only used when stream_mode = "multi_message".
debounce_ms: Option<u64>Inbound message debounce window in milliseconds for this Telegram alias.
When set, overrides the global [channels].debounce_ms for this channel
only. 0 or unset falls back to the global value.
interrupt_on_new_message: boolWhen true, a newer Telegram message from the same sender in the same chat 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 in groups. Direct messages are always processed.
per_user_session: boolWhen true (default), group-chat sessions key on the sender, so
distinct members of the same group (or forum topic) each get an
isolated conversation context (matches the existing behavior). When
false, all members of a group chat share one session scoped to the
chat (and forum topic, when present), so the agent keeps full
conversation context regardless of which member writes. Sharing the
session shares its session-scoped controls too: any member’s /new
resets the shared history for the whole group/topic, and a member’s
session-level /model route override applies to everyone in it,
while /stop and message debouncing stay personal to each sender.
1-on-1 chats are unaffected (chat_id is already unique per user-bot
pair).
passive_group_context: boolWhen true in Telegram group chats, unaddressed messages that pass
sender/chat authorization are recorded as passive conversation context
without starting an agent turn. Lets the bot follow the discussion and
answer with full context when later @-mentioned. Default: false.
Recording passive messages requires mention_only = true: with the
default mention_only = false the bot already answers every
authorized group message, so no unaddressed message is left to record.
Shared history is not gated that way. Enabling this flag puts every
group/topic message on one shared session, the way
per_user_session = false does, whatever mention_only says and
whatever per_user_session says, because an observation filed in the
observed member’s own session could never answer the participant who
later @-mentions the bot. Members therefore share conversation
context and the session-scoped controls that come with it, so any
member’s /new resets the history for the whole group/topic.
Scheduling stays personal: message debouncing, /stop and
interruption still key on the sender.
ack_reactions: Option<bool>Override for the top-level ack_reactions setting. When None, the
channel falls back to [channels].ack_reactions. When set
explicitly, it takes precedence.
proxy_url: Option<String>Per-channel proxy URL (http, https, socks5, socks5h).
Overrides the global [proxy] setting for this channel only.
approval_timeout_secs: u64How long (seconds) to wait for the operator to tap an inline-keyboard button on a tool approval prompt before auto-denying. Default: 120.
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 TelegramConfig
impl TelegramConfig
Sourcepub fn configurable_prefix() -> &'static str
pub fn configurable_prefix() -> &'static str
Returns the #[prefix] value for this Configurable struct.
Sourcepub fn init_requires_explicit_config() -> bool
pub fn init_requires_explicit_config() -> bool
True when this struct has a required leaf field that a
bare/ancestor-prefix init_defaults scaffold must not
materialize (it would fill the field with its Rust
Default, which prune_empty_leaves then strips on save,
leaving a partial sub-table that fails strict reload).
Explicitly targeting this section (or a descendant of it)
still scaffolds regardless of this flag, so the section can
be materialized for the operator to fill in.
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>
Trait Implementations§
Source§impl ChannelConfig for TelegramConfig
impl ChannelConfig for TelegramConfig
Source§impl Clone for TelegramConfig
impl Clone for TelegramConfig
Source§fn clone(&self) -> TelegramConfig
fn clone(&self) -> TelegramConfig
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 TelegramConfig
impl Debug for TelegramConfig
Source§impl Default for TelegramConfig
impl Default for TelegramConfig
Source§fn default() -> TelegramConfig
fn default() -> TelegramConfig
Source§impl<'de> Deserialize<'de> for TelegramConfig
impl<'de> Deserialize<'de> for TelegramConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TelegramConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TelegramConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl HasReplyPacing for TelegramConfig
impl HasReplyPacing for TelegramConfig
fn reply_min_interval_secs(&self) -> u64
fn reply_queue_depth_max(&self) -> u16
Source§impl JsonSchema for TelegramConfig
impl JsonSchema for TelegramConfig
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 TelegramConfig
impl MaskSecrets for TelegramConfig
fn mask_secrets(&mut self)
fn restore_secrets_from(&mut self, current: &TelegramConfig)
Source§impl Serialize for TelegramConfig
impl Serialize for TelegramConfig
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 TelegramConfig
impl RefUnwindSafe for TelegramConfig
impl Send for TelegramConfig
impl Sync for TelegramConfig
impl Unpin for TelegramConfig
impl UnsafeUnpin for TelegramConfig
impl UnwindSafe for TelegramConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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