telega/models/bot_command

Types

pub type BotCommand {
  BotCommand(command: String, description: String)
}

Constructors

  • BotCommand(command: String, description: String)

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

    Arguments

    • command

      Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores.

    • description

      Description of the command; 1-256 characters.

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) Unique identifier of the target user

pub type BotCommandParameters {
  BotCommandParameters(
    scope: Option(BotCommandScope),
    language_code: Option(String),
  )
}

Constructors

  • BotCommandParameters(
      scope: Option(BotCommandScope),
      language_code: Option(String),
    )

    Arguments

    • scope

      An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.

    • language_code

      A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands

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

pub type BotCommandScope {
  BotCommandDefaultScope
  BotCommandAllPrivateChatsScope
  BotCommandScopeAllGroupChats
  BotCommandScopeAllChatAdministrators
  BotCommandScopeChat(chat_id: Int)
  BotCommandScopeChatString(chat_id: IntOrString)
  BotCommandScopeChatAdministrators(chat_id: IntOrString)
  BotCommandScopeChatMember(chat_id: IntOrString, user_id: Int)
}

Constructors

  • BotCommandDefaultScope

    Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.

  • BotCommandAllPrivateChatsScope

    Represents the scope of bot commands, covering all private chats.

  • BotCommandScopeAllGroupChats

    Represents the scope of bot commands, covering all group and supergroup chats.

  • BotCommandScopeAllChatAdministrators

    Represents the scope of bot commands, covering all group and supergroup chat administrators.

  • BotCommandScopeChat(chat_id: Int)

    Represents the scope of bot commands, covering a specific chat.

    Arguments

    • chat_id

      Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

  • BotCommandScopeChatString(chat_id: IntOrString)

    Represents the scope of bot commands, covering a specific chat.

    Arguments

    • chat_id

      Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

  • BotCommandScopeChatAdministrators(chat_id: IntOrString)

    Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.

    Arguments

    • chat_id

      Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

  • BotCommandScopeChatMember(chat_id: IntOrString, user_id: Int)

    Represents the scope of bot commands, covering a specific member of a group or supergroup chat.

    Arguments

    • chat_id

      Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

    • user_id

      Unique identifier of the target user

Functions

pub fn decode(
  json: Dynamic,
) -> Result(List(BotCommand), List(DecodeError))
pub fn encode_botcommand_parameters(
  params: BotCommandParameters,
) -> List(#(String, Json))
pub fn from(
  commands: List(#(String, String)),
) -> List(BotCommand)
pub fn new_botcommand_parameters() -> BotCommandParameters

An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands

pub fn scope_to_json(scope: BotCommandScope) -> Json
Search Document