mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added the ability to set different bot names for different user languages using the method setMyName.
This commit is contained in:
@@ -3443,6 +3443,24 @@ class TeleBot:
|
||||
"""
|
||||
result = apihelper.get_my_commands(self.token, scope, language_code)
|
||||
return [types.BotCommand.de_json(cmd) for cmd in result]
|
||||
|
||||
def set_my_name(self, name: Optional[str]=None, language_code: Optional[str]=None):
|
||||
"""
|
||||
Use this method to change the bot's name. Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setmyname
|
||||
|
||||
:param name: Optional. New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param language_code: Optional. A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose
|
||||
language there is no dedicated name.
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
:return: True on success.
|
||||
"""
|
||||
|
||||
return apihelper.set_my_name(self.token, name, language_code)
|
||||
|
||||
def set_my_description(self, description: Optional[str]=None, language_code: Optional[str]=None):
|
||||
"""
|
||||
@@ -3450,6 +3468,8 @@ class TeleBot:
|
||||
the chat with the bot if the chat is empty.
|
||||
Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setmydescription
|
||||
|
||||
:param description: New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
|
||||
:type description: :obj:`str`
|
||||
|
||||
@@ -3467,6 +3487,8 @@ class TeleBot:
|
||||
Use this method to get the current bot description for the given user language.
|
||||
Returns BotDescription on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#getmydescription
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
@@ -3481,6 +3503,8 @@ class TeleBot:
|
||||
is sent together with the link when users share the bot.
|
||||
Returns True on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#setmyshortdescription
|
||||
|
||||
:param short_description: New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
|
||||
:type short_description: :obj:`str`
|
||||
|
||||
@@ -3498,6 +3522,8 @@ class TeleBot:
|
||||
Use this method to get the current bot short description for the given user language.
|
||||
Returns BotShortDescription on success.
|
||||
|
||||
Telegram documentation: https://core.telegram.org/bots/api#getmyshortdescription
|
||||
|
||||
:param language_code: A two-letter ISO 639-1 language code or an empty string
|
||||
:type language_code: :obj:`str`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user