Skip to main content

BotConfig

Defined in the bots module.
Rust AI Agent SDK Configuration for a bot.

Fields

NameTypeDescription
tokenStringBot token for authentication
platformStringPlatform name (telegram, discord, slack, etc.)
use_webhooksboolWhether to use webhooks (vs polling)
webhook_urlOption<String>Webhook URL (if use_webhooks is true)
polling_intervalu64Polling interval in seconds
default"/")-
command_prefixStringCommand prefix (default: ”/“)
extraHashMap<StringAdditional platform-specific configuration
serde_json:Value>Additional platform-specific configuration

Methods

new

fn new(token: impl Into<String>, platform: impl Into<String>) -> Self
Create a new bot config. Parameters:
NameType
tokenimpl Into&lt;String&gt;
platformimpl Into&lt;String&gt;

webhooks

fn webhooks(mut self, url: impl Into<String>) -> Self
Enable webhooks. Parameters:
NameType
urlimpl Into&lt;String&gt;

polling_interval

fn polling_interval(mut self, seconds: u64) -> Self
Set polling interval. Parameters:
NameType
secondsu64

command_prefix

fn command_prefix(mut self, prefix: impl Into<String>) -> Self
Set command prefix. Parameters:
NameType
prefiximpl Into&lt;String&gt;

extra

fn extra(mut self, key: impl Into<String>, value: serde_json::Value) -> Self
Add extra configuration. Parameters:
NameType
keyimpl Into&lt;String&gt;
valueserde_json::Value

Source

View on GitHub

praisonai/src/bots/mod.rs at line 375