telega/api

Functions

pub fn answer_callback_query(
  ctx ctx: Context(a),
  parameters parameters: AnswerCallbackQueryParameters,
) -> Result(Bool, String)

Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

Official reference: https://core.telegram.org/bots/api#answercallbackquery

pub fn close(config config: Config) -> 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(
  config config: Config,
  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(
  config config: Config,
) -> 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(
  config config: Config,
) -> Result(Bool, String)

The same as delete_webhook but also drops all pending updates.

pub fn edit_message_text(
  ctx ctx: Context(a),
  parameters parameters: EditMessageTextParameters,
) -> Result(EditMessageTextResult, String)

Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

Official reference: https://core.telegram.org/bots/api#editmessagetext

pub fn get_me(ctx 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(
  config config: Config,
  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(
  config config: Config,
) -> Result(WebhookInfo, String)

Use this method to get current webhook status.

Official reference: https://core.telegram.org/bots/api#getwebhookinfo

pub fn log_out(config config: Config) -> 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 reply_with_markup(
  ctx ctx: Context(a),
  text text: String,
  markup reply_markup: ReplyMarkup,
) -> Result(Message, String)

Use this method to send text messages with keyboard markup.

Official reference: https://core.telegram.org/bots/api#sendmessage

pub fn reply_with_parameters(
  config config: Config,
  parameters parameters: SendMessageParameters,
) -> Result(Message, String)

Use this method to send text messages with additional parameters.

Official reference: https://core.telegram.org/bots/api#sendmessage

pub fn send_dice(
  ctx 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(
  config config: Config,
  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(config config: Config) -> Result(Bool, String)

Set the webhook URL using setWebhook API.

Official reference: https://core.telegram.org/bots/api#setwebhook

Search Document