telega/update

Types

pub type Command {
  Command(text: String, command: String, payload: Option(String))
}

Constructors

  • Command(text: String, command: String, payload: Option(String))

    Represents a command message.

    Arguments

    text

    Whole command message

    command

    Command name without the leading slash

    payload

    The command arguments, if any.

Messages represent the data that the bot receives from the Telegram API.

pub type Update {
  TextUpdate(chat_id: Int, text: String, raw: Message)
  CommandUpdate(chat_id: Int, command: Command, raw: Message)
  CallbackQueryUpdate(from_id: Int, raw: CallbackQuery)
  UnknownUpdate(raw: ModelUpdate)
}

Constructors

  • TextUpdate(chat_id: Int, text: String, raw: Message)
  • CommandUpdate(chat_id: Int, command: Command, raw: Message)
  • CallbackQueryUpdate(from_id: Int, raw: CallbackQuery)
  • UnknownUpdate(raw: ModelUpdate)

Functions

pub fn decode(json: Dynamic) -> Result(Update, String)

Decode a update from the Telegram API to Update instance.

Search Document