telega/model
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
-
BotCommandDefaultScopeRepresents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.
-
BotCommandAllPrivateChatsScopeRepresents the scope of bot commands, covering all private chats.
-
BotCommandScopeAllGroupChatsRepresents the scope of bot commands, covering all group and supergroup chats.
-
BotCommandScopeAllChatAdministratorsRepresents 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
-
pub type Chat {
Chat(
id: Int,
username: Option(String),
first_name: Option(String),
last_name: Option(String),
is_forum: Option(Bool),
)
}
Constructors
-
Chat( id: Int, username: Option(String), first_name: Option(String), last_name: Option(String), is_forum: Option(Bool), )Official reference: https://core.telegram.org/bots/api#chat
Arguments
-
id
Unique identifier for this chat.
-
username
Username, for private chats, supergroups and channels if available
-
first_name
First name of the other party in a private chat
-
last_name
Last name of the other party in a private chat
-
is_forum
True, if the supergroup chat is a forum (has topics enabled)
-
pub type InlineKeyboardButton {
InlineKeyboardButton(
text: String,
url: Option(String),
callback_data: Option(String),
switch_inline_query: Option(String),
switch_inline_query_current_chat: Option(String),
pay: Option(Bool),
)
}
Constructors
-
InlineKeyboardButton( text: String, url: Option(String), callback_data: Option(String), switch_inline_query: Option(String), switch_inline_query_current_chat: Option(String), pay: Option(Bool), )Official reference: https://core.telegram.org/bots/api#inlinekeyboardbutton
Arguments
-
text
Label text on the button
-
url
HTTP or
tg://URL to be opened when the button is pressed. Linkstg://user?id=<user_id>can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. -
callback_data
Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
-
switch_inline_query
If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.
-
switch_inline_query_current_chat
set, pressing the button will insert the bot’s username and the specified inline query in the current chat’s input field. May be empty, in which case only the bot’s username will be inserted.
This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.
-
pay
Specify True, to send a Pay button.
NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
-
Label text on the button
HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.
set, pressing the button will insert the bot’s username and the specified inline query in the current chat’s input field. May be empty, in which case only the bot’s username will be inserted.
This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Specify True, to send a Pay button.
NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
pub type InlineKeyboardMarkup {
InlineKeyboardMarkup(
inline_keyboard: List(List(InlineKeyboardButton)),
)
}
Constructors
-
InlineKeyboardMarkup( inline_keyboard: List(List(InlineKeyboardButton)), )Official reference: https://core.telegram.org/bots/api#inlinekeyboardmarkup
pub type IntOrString {
Int(Int)
String(String)
}
Constructors
-
Int(Int) -
String(String)
pub type Message {
Message(
message_id: Int,
message_thread_id: Option(Int),
from: Option(User),
sender_chat: Option(Chat),
sender_boost_count: Option(Int),
date: Int,
chat: Chat,
is_topic_message: Option(Bool),
is_automatic_forward: Option(Bool),
reply_to_message: Option(Message),
via_bot: Option(User),
edit_date: Option(Int),
has_protected_content: Option(Bool),
media_group_id: Option(String),
author_signature: Option(String),
text: Option(String),
entities: Option(List(MessageEntity)),
caption: Option(String),
caption_entities: Option(List(MessageEntity)),
has_media_spoiler: Option(Bool),
new_chat_members: Option(List(User)),
left_chat_member: Option(User),
new_chat_title: Option(String),
delete_chat_photo: Option(Bool),
group_chat_created: Option(Bool),
supergroup_chat_created: Option(Bool),
channel_chat_created: Option(Bool),
migrate_to_chat_id: Option(Int),
migrate_from_chat_id: Option(Int),
connected_website: Option(String),
reply_markup: Option(InlineKeyboardMarkup),
)
}
Constructors
-
Message( message_id: Int, message_thread_id: Option(Int), from: Option(User), sender_chat: Option(Chat), sender_boost_count: Option(Int), date: Int, chat: Chat, is_topic_message: Option(Bool), is_automatic_forward: Option(Bool), reply_to_message: Option(Message), via_bot: Option(User), edit_date: Option(Int), has_protected_content: Option(Bool), media_group_id: Option(String), author_signature: Option(String), text: Option(String), entities: Option(List(MessageEntity)), caption: Option(String), caption_entities: Option(List(MessageEntity)), has_media_spoiler: Option(Bool), new_chat_members: Option(List(User)), left_chat_member: Option(User), new_chat_title: Option(String), delete_chat_photo: Option(Bool), group_chat_created: Option(Bool), supergroup_chat_created: Option(Bool), channel_chat_created: Option(Bool), migrate_to_chat_id: Option(Int), migrate_from_chat_id: Option(Int), connected_website: Option(String), reply_markup: Option(InlineKeyboardMarkup), )Official reference: https://core.telegram.org/bots/api#message
Arguments
-
message_id
Unique message identifier inside this chat
-
message_thread_id
Unique identifier of a message thread to which the message belongs; for supergroups only
-
from
Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
-
sender_chat
Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
-
sender_boost_count
If the sender of the message boosted the chat, the number of boosts added by the user
-
date
Date the message was sent in Unix time. It is always a positive number, representing a valid date.
-
chat
Chat the message belongs to
-
is_topic_message
True, if the message is sent to a forum topic
-
is_automatic_forward
True, if the message is a channel post that was automatically forwarded to the connected discussion group
-
reply_to_message
For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
-
edit_date
Date the message was last edited in Unix time
-
has_protected_content
True, if the message can’t be forwarded
-
media_group_id
The unique identifier of a media message group this message belongs to
-
author_signature
Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
-
text
For text messages, the actual UTF-8 text of the message
-
entities
For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
-
caption_entities
For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
-
has_media_spoiler
True, if the message media is covered by a spoiler animation
-
new_chat_members
New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
-
left_chat_member
A member was removed from the group, information about them (this member may be the bot itself)
-
new_chat_title
A chat title was changed to this value
-
delete_chat_photo
Service message: the chat photo was deleted
-
group_chat_created
Service message: the group has been created
-
supergroup_chat_created
Service message: the supergroup has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
-
channel_chat_created
Service message: the channel has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
-
migrate_to_chat_id
The group has been migrated to a supergroup with the specified identifier.
-
migrate_from_chat_id
The supergroup has been migrated from a group with the specified identifier.
-
connected_website
The domain name of the website on which the user has logged in. More about Telegram Login >>
-
reply_markup
Inline keyboard attached to the message.
login_urlbuttons are represented as ordinaryurlbuttons.
-
pub type MessageEntity {
MessageEntity(
entity_type: String,
offset: Int,
length: Int,
url: Option(String),
user: Option(User),
language: Option(String),
custom_emoji_id: Option(String),
)
}
Constructors
-
MessageEntity( entity_type: String, offset: Int, length: Int, url: Option(String), user: Option(User), language: Option(String), custom_emoji_id: Option(String), )Official reference: https://core.telegram.org/bots/api#messageentity
Arguments
-
entity_type
Type of the entity. Currently, can be “mention” (
@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) -
offset
Offset in UTF-16 code units to the start of the entity
-
length
Length of the entity in UTF-16 code units
-
url
For “text_link” only, URL that will be opened after user taps on the text
-
user
For “text_mention” only, the mentioned user
-
language
For “pre” only, the programming language of the entity text
-
custom_emoji_id
For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker
-
Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified
If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername)
Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic.
Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn’t found in the original message.
Mode for parsing entities in the quote. See formatting options for more details.
A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode.
Position of the quote in the original message in UTF-16 code units
pub type ReplyMarkup {
ReplyInlineKeyboardMarkup(
inline_keyboard: List(List(InlineKeyboardButton)),
)
ReplyKeyboardMarkup(
keyboard: List(List(Keyboard)),
is_persistent: Option(Bool),
resize_keyboard: Option(Bool),
one_time_keyboard: Option(Bool),
input_field_placeholder: Option(String),
selective: Option(Bool),
)
ReplyKeyboardRemove(
remove_keyboard: Bool,
selective: Option(Bool),
)
}
Constructors
-
ReplyInlineKeyboardMarkup( inline_keyboard: List(List(InlineKeyboardButton)), )This object represents an inline keyboard that appears right next to the message it belongs to. Official reference: https://core.telegram.org/bots/api#inlinekeyboardmarkup
Arguments
-
inline_keyboard
List of button rows, each represented by an List of InlineKeyboardButton objects
-
-
ReplyKeyboardMarkup( keyboard: List(List(Keyboard)), is_persistent: Option(Bool), resize_keyboard: Option(Bool), one_time_keyboard: Option(Bool), input_field_placeholder: Option(String), selective: Option(Bool), )This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
Arguments
-
keyboard
Array of button rows, each represented by an Array of KeyboardButton objects
-
is_persistent
Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
-
resize_keyboard
Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app’s standard keyboard.
-
one_time_keyboard
Requests clients to hide the keyboard as soon as it’s been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
-
input_field_placeholder
The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
-
selective
Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.
Example: A user requests to change the bot’s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
-
-
ReplyKeyboardRemove( remove_keyboard: Bool, selective: Option(Bool), )Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
Arguments
-
remove_keyboard
Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)
-
selective
Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.
Example: A user requests to change the bot’s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
-
pub type ReplyParameters {
ReplyParameters(
message_id: Int,
chat_id: Option(IntOrString),
allow_sending_without_reply: Option(Bool),
quote: Option(String),
quote_parse_mode: Option(String),
quote_entities: Option(List(MessageEntity)),
quote_position: Option(Int),
)
}
Constructors
-
ReplyParameters( message_id: Int, chat_id: Option(IntOrString), allow_sending_without_reply: Option(Bool), quote: Option(String), quote_parse_mode: Option(String), quote_entities: Option(List(MessageEntity)), quote_position: Option(Int), )Describes reply parameters for the message that is being sent. Official reference: https://core.telegram.org/bots/api#replyparameters
Arguments
-
message_id
Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified
-
chat_id
If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format
@channelusername) -
allow_sending_without_reply
Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic.
-
quote
Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn’t found in the original message.
-
quote_parse_mode
Mode for parsing entities in the quote. See formatting options for more details.
-
quote_entities
A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode.
-
quote_position
Position of the quote in the original message in UTF-16 code units
-
pub type SendDiceParameters {
SendDiceParameters(
chat_id: Int,
message_thread_id: Option(Int),
emoji: Option(String),
disable_notification: Option(Bool),
protect_content: Option(Bool),
reply_parameters: Option(ReplyParameters),
)
}
Constructors
-
SendDiceParameters( chat_id: Int, message_thread_id: Option(Int), emoji: Option(String), disable_notification: Option(Bool), protect_content: Option(Bool), reply_parameters: Option(ReplyParameters), )Arguments
-
message_thread_id
Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
-
emoji
Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲”
-
disable_notification
Sends the message silently. Users will receive a notification with no sound.
-
protect_content
Protects the contents of the sent message from forwarding
-
reply_parameters
Description of the message to reply to
-
pub type Update {
Update(message: Message, update_id: Int)
}
Constructors
-
Update(message: Message, update_id: Int)Official reference: https://core.telegram.org/bots/api#update
Arguments
-
update_id
The update’s unique identifier.
-
pub type User {
User(
id: Int,
is_bot: Bool,
first_name: String,
last_name: Option(String),
username: Option(String),
language_code: Option(String),
is_premium: Option(Bool),
added_to_attachment_menu: Option(Bool),
)
}
Constructors
-
User( id: Int, is_bot: Bool, first_name: String, last_name: Option(String), username: Option(String), language_code: Option(String), is_premium: Option(Bool), added_to_attachment_menu: Option(Bool), )Official reference: https://core.telegram.org/bots/api#user
Arguments
-
id
Unique identifier for this user or bot.
-
first_name
User’s or bot’s first name
-
last_name
User’s or bot’s last name
-
username
Username, for private chats, supergroups and channels if available
-
language_code
IETF language tag of the user’s language
-
is_premium
True, if this user is a Telegram Premium user
-
added_to_attachment_menu
True, if this user added the bot to the attachment menu
-
pub type WebhookInfo {
WebhookInfo(
url: String,
has_custom_certificate: Bool,
pending_update_count: Int,
ip_address: Option(String),
last_error_date: Option(Int),
last_error_message: Option(String),
last_synchronization_error_date: Option(Int),
max_connections: Option(Int),
allowed_updates: Option(List(String)),
)
}
Constructors
-
WebhookInfo( url: String, has_custom_certificate: Bool, pending_update_count: Int, ip_address: Option(String), last_error_date: Option(Int), last_error_message: Option(String), last_synchronization_error_date: Option(Int), max_connections: Option(Int), allowed_updates: Option(List(String)), )Describes the current status of a webhook.
Official reference: WebhookInfo
Arguments
-
url
Webhook URL, may be empty if webhook is not set up
-
has_custom_certificate
True, if a custom certificate was provided for webhook certificate checks
-
pending_update_count
Number of updates awaiting delivery
-
ip_address
Currently used webhook IP address
-
last_error_date
Unix time for the most recent error that happened when trying to deliver an update via webhook
-
last_error_message
Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
-
last_synchronization_error_date
Maximum allowed payload size for incoming update
-
max_connections
Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
-
allowed_updates
A list of update types the bot is subscribed to. Defaults to all update types
-
Functions
pub fn bot_command_scope_to_json(scope: BotCommandScope) -> Json
pub fn bot_commands_from(
commands: List(#(String, String)),
) -> List(BotCommand)
pub fn decode_bot_command(
json: Dynamic,
) -> Result(List(BotCommand), List(DecodeError))
pub fn decode_inline_button(
json: Dynamic,
) -> Result(InlineKeyboardButton, List(DecodeError))
pub fn decode_inline_markup(
json: Dynamic,
) -> Result(InlineKeyboardMarkup, List(DecodeError))
pub fn decode_message(
json: Dynamic,
) -> Result(Message, List(DecodeError))
Unique message identifier inside this chat
Unique identifier of a message thread to which the message belongs; for supergroups only
Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
If the sender of the message boosted the chat, the number of boosts added by the user
Date the message was sent in Unix time. It is always a positive number, representing a valid date.
Chat the message belongs to
True, if the message is sent to a forum topic
True, if the message is a channel post that was automatically forwarded to the connected discussion group
For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
Date the message was last edited in Unix time
True, if the message can’t be forwarded
The unique identifier of a media message group this message belongs to
Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
For text messages, the actual UTF-8 text of the message
For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
True, if the message media is covered by a spoiler animation
New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
A member was removed from the group, information about them (this member may be the bot itself)
A chat title was changed to this value
Service message: the chat photo was deleted
Service message: the group has been created
Service message: the supergroup has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
Service message: the channel has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
The group has been migrated to a supergroup with the specified identifier.
The supergroup has been migrated from a group with the specified identifier.
The domain name of the website on which the user has logged in. More about Telegram Login >>
Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
pub fn decode_message_entity(
json: Dynamic,
) -> Result(MessageEntity, List(DecodeError))
Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers)
Offset in UTF-16 code units to the start of the entity
Length of the entity in UTF-16 code units
For “text_link” only, URL that will be opened after user taps on the text
For “text_mention” only, the mentioned user
For “pre” only, the programming language of the entity text
For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker
pub fn decode_update(
json: Dynamic,
) -> Result(Update, List(DecodeError))
Decode a message from the Telegram API.
pub fn decode_user(
json: Dynamic,
) -> Result(User, List(DecodeError))
Unique identifier for this user or bot. User’s or bot’s first name User’s or bot’s last name Username, for private chats, supergroups and channels if available IETF language tag of the user’s language True, if this user is a Telegram Premium user True, if this user added the bot to the attachment menu
pub fn decode_webhook_info(
json: Dynamic,
) -> Result(WebhookInfo, List(DecodeError))
Webhook URL, may be empty if webhook is not set up True, if a custom certificate was provided for webhook certificate checks Number of updates awaiting delivery Currently used webhook IP address Unix time for the most recent error that happened when trying to deliver an update via webhook Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook Maximum allowed payload size for incoming update Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery A list of update types the bot is subscribed to. Defaults to all update types
pub fn encode_botcommand_parameters(
params: BotCommandParameters,
) -> List(#(String, Json))
pub fn encode_message_entity(
message_entity: MessageEntity,
) -> Json
pub fn encode_reply_parameters(
reply_parameters: ReplyParameters,
) -> Json
Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.
Example: A user requests to change the bot’s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
pub fn encode_send_dice_parameters(
params: SendDiceParameters,
) -> Json
pub fn encode_user(user: User) -> Json
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 new_send_dice_parameters(
chat_id chat_id: Int,
) -> SendDiceParameters
Unique identifier for the target message thread (topic) of the forum; for forum supergroups only Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” Sends the message silently. Users will receive a notification with no sound. Protects the contents of the sent message from forwarding Description of the message to reply to