telega/api
Functions
pub fn close(bot: Bot) -> Result(Bool, String)
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn’t launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched.
Official reference: https://core.telegram.org/bots/api#close
pub fn delete_my_commands(
ctx: Context(a),
parameters parameters: Option(BotCommandParameters),
) -> Result(Bool, String)
Use this method to delete the list of the bot’s commands for the given scope and user language. After deletion, higher level commands will be shown to affected users.
Official reference: https://core.telegram.org/bots/api#deletemycommands
pub fn delete_webhook(bot: Bot) -> Result(Bool, String)
Use this method to remove webhook integration if you decide to switch back to getUpdates.
Official reference: https://core.telegram.org/bots/api#deletewebhook
pub fn delete_webhook_and_drop_updates(
bot: Bot,
) -> Result(Bool, String)
The same as delete_webhook but also drops all pending updates.
pub fn get_me(ctx: Context(a)) -> Result(User, String)
A simple method for testing your bot’s authentication token.
Official reference: https://core.telegram.org/bots/api#getme
pub fn get_my_commands(
ctx: Context(a),
parameters parameters: Option(BotCommandParameters),
) -> Result(List(BotCommand), String)
Use this method to get the current list of the bot’s commands for the given scope and user language.
Official reference: https://core.telegram.org/bots/api#getmycommands
pub fn get_webhook_info(bot: Bot) -> Result(WebhookInfo, String)
Use this method to get current webhook status.
Official reference: https://core.telegram.org/bots/api#getwebhookinfo
pub fn log_out(bot: Bot) -> Result(Bool, String)
Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes.
Official reference: https://core.telegram.org/bots/api#logout
pub fn reply(
ctx ctx: Context(a),
text text: String,
) -> Result(Message, String)
Use this method to send text messages.
Official reference: https://core.telegram.org/bots/api#sendmessage
pub fn send_dice(
ctx: Context(a),
parameters parameters: Option(SendDiceParameters),
) -> Result(Message, String)
Use this method to send an animated emoji that will display a random value.
Official reference: https://core.telegram.org/bots/api#senddice
pub fn set_my_commands(
ctx ctx: Context(a),
commands commands: List(BotCommand),
parameters parameters: Option(BotCommandParameters),
) -> Result(Bool, String)
Use this method to change the list of the bot’s commands. See commands documentation for more details about bot commands.
Official reference: https://core.telegram.org/bots/api#setmycommands
pub fn set_webhook(bot: Bot) -> Result(Bool, String)
Set the webhook URL using setWebhook API.
Official reference: https://core.telegram.org/bots/api#setwebhook