Bot usage
How to work with a Telegram bot description (full and short)
To configure welcome message
tg_set_bot_description(description, language_code) - bot description shown when the chat with the bot is empty
Parameters:
description
Passing an empty string as the bot description will remove the existing description.
language_code
A two-letter language code according to the ISO 639-1 standard for text localization.
If left empty, the short description will be applied to all users who do not have a specific short description set.
To configure short preview description
tg_set_bot_short_description(description, language_code) - a short description of the bot that appears on the bot’s profile page and is sent along with the link when users share the bot.
Parameters:
description
Passing an empty string as the bot description will remove the existing description.
language_code
A two-letter language code according to the ISO 639-1 standard for text localization.
If left empty, the short description will be applied to all users who do not have a specific short description set.
To get current description
tg_get_bot_description(language_code) - use this method to get the current bot description for the specified user language.
language_code
A two-letter language code according to the ISO 639-1 standard for text localization.
If left empty, the short description will be applied to all users who do not have a specific short description set.
To get current short description
tg_get_bot_short_description(language_code) - use this method to get the current short description of the bot for the specified user language.
language_code
A two-letter language code according to the ISO 639-1 standard for text localization.
If left empty, the short description will be applied to all users who do not have a specific short description set.
How to configure commands for the bot
To configure commands
tg_set_command(commands, language, scope, platform_id, user_id)
! commands
Bot commands in the form of a list of lists, each nested list consists of 2 elements:
1 – the command name, 2 – its description (there is a limit of 100 commands).
language
A two-letter language code according to ISO 639-1, e.g., 'ru' or 'en'.
If not specified, the commands will apply to all users whose language does not have specifically assigned commands.
scope
A parameter that defines the scope of users for whom the commands are created. The default value is 'default'.
platform_id
Chat identifier within Telegram *.
Applies only for specific values of the scope parameter.
user_id
User identifier within Telegram *.
Applies only for specific values of the scope parameter.
How to view commands for the bot
tg_get_command()
To view commands
tg_get_command(language, scope, platform_id, user_id)
language
A two-letter language code according to ISO 639-1, e.g., 'ru' or 'en'. If not specified, commands applied to all users within the given area who do not have dedicated commands for their language will be shown.
scope
A parameter that defines the scope of users for whom the commands should be shown (optional parameter; if not used, the default value 'default' will be applied).
platform_id
Chat identifier within Telegram *.
Applies only for specific values of the scope parameter.
user_id
User identifier within Telegram *.
Applies only for specific values of the scope parameter..
How to delete commands in the bot
tg_delete_command()
To delete commands
tg_delete_command(language, scope, platform_id, user_id), where
language
A two-letter language code according to ISO 639-1, e.g., 'ru' or 'en' (optional parameter; if not specified, commands applied to all users within the given scope who do not have dedicated commands for their language will be deleted).
scope
A parameter that defines the scope of users for whom the commands will be deleted. If not specified, the default value 'default' will be applied.
platform_id
Chat identifier (optional parameter, applies only for specific values of the scope parameter).
user_id
User identifier (optional parameter, applies only for specific values of the scope parameter).
How to configure reactions to commands
For commands in a private chat with the bot, you need to react to messages like: '/command_name' – where command_name is the command.
For commands in groups and chats, messages will appear as: '/command_name@bot_username' – where command_name is the command and @bot_username is the bot’s username.
Scope values list:
'default'
The default parameter implies that the commands will work in private messages with the bot.
'all_private_chats'
All private chats: commands are available to everyone in private chats where the bot has been added.
'all_group_chats'
All group and supergroup chats: commands are available to everyone in these types of chats where the bot has been added.
'all_chat_administrators'
Commands for administrators of all group and supergroup chats where the bot has been added.
'chat'
Commands for a specific chat (if you choose this option, you should specify the platform_id).
'chat_administrators'
Commands for administrators of a specific chat (if you choose this option, you should specify the platform_id).
'chat_member'
Commands for a specific member of a particular chat (if you choose this option, you should specify both platform_id and user_id; the specified user must be a member of the given chat).
Last updated



