telega/bot

Types

String to compare to X-Telegram-Bot-Api-Secret-Token The maximum number of times to retry sending a API message. Default is 3. The Telegram Bot API URL. Default is “https://api.telegram.org”. This is useful for running a local server.

pub type Bot {
  Bot(config: Config)
}

Constructors

  • Bot(config: Config)

    Bot constructor. Represents a bot configuration wich will be used to create a Bot instance per chat.

pub opaque type Config

Handlers context.

pub type Context(session) {
  Context(message: Message, bot: Bot, session: session)
}

Constructors

  • Context(message: Message, bot: Bot, session: session)

Functions

pub fn get_max_retry_attempts(bot: Bot) -> Int
pub fn get_secret_token(bot: Bot) -> String
pub fn get_server_url(bot: Bot) -> String
pub fn get_tg_api_url(bot: Bot) -> String
pub fn get_token(bot: Bot) -> String
pub fn get_webhook_path(bot: Bot) -> String
pub fn new(
  token token: String,
  url server_url: String,
  webhook_path webhook_path: String,
  secret_token secret_token: Option(String),
) -> Bot

Creates a new Bot with the given options.

If secret_token is not provided, a random one will be generated.

Search Document