Multilanguage message in version command
This commit is contained in:
parent
1018876227
commit
a7fd054106
@ -11,7 +11,7 @@ __author__ = "Davide Testa"
|
||||
__email__ = "davide@davte.it"
|
||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||
__license__ = "GNU General Public License v3.0"
|
||||
__version__ = "2.5.17"
|
||||
__version__ = "2.5.18"
|
||||
__maintainer__ = "Davide Testa"
|
||||
__contact__ = "t.me/davte"
|
||||
|
||||
|
@ -870,7 +870,8 @@ async def get_new_versions(bot: Bot,
|
||||
return news
|
||||
|
||||
|
||||
async def _version_command(bot: Bot, update, user_record):
|
||||
async def _version_command(bot: Bot, update: dict,
|
||||
user_record: OrderedDict, language: str):
|
||||
last_commit = await get_last_commit()
|
||||
text = bot.get_message(
|
||||
'admin', 'version_command', 'header',
|
||||
@ -883,13 +884,19 @@ async def _version_command(bot: Bot, update, user_record):
|
||||
for package in bot.packages
|
||||
)
|
||||
temporary_message = await bot.send_message(
|
||||
text=text + '\n\n⏳ Checking for updates... ☑️',
|
||||
text=text + '\n\n' + bot.get_message(
|
||||
'admin', 'version_command', 'checking_for_updates',
|
||||
language=language
|
||||
),
|
||||
update=update,
|
||||
send_default_keyboard=False
|
||||
)
|
||||
news = await get_new_versions(bot=bot)
|
||||
if not news:
|
||||
text += '\n\n⌛️ All packages are updated! ✅'
|
||||
text += '\n\n' + bot.get_message(
|
||||
'admin', 'version_command', 'all_packages_updated',
|
||||
language=language
|
||||
)
|
||||
else:
|
||||
text += '\n\n' + bot.get_message(
|
||||
'admin', 'updates_available', 'header',
|
||||
@ -1997,7 +2004,8 @@ def init(telegram_bot: Bot,
|
||||
},
|
||||
show_in_keyboard=False,
|
||||
authorization_level='admin')
|
||||
async def version_command(bot, update, user_record):
|
||||
async def version_command(bot, update, user_record, language):
|
||||
return await _version_command(bot=bot,
|
||||
update=update,
|
||||
user_record=user_record)
|
||||
user_record=user_record,
|
||||
language=language)
|
||||
|
@ -617,21 +617,29 @@ default_admin_messages = {
|
||||
},
|
||||
},
|
||||
'version_command': {
|
||||
'reply_keyboard_button': {
|
||||
'en': "Version #️⃣",
|
||||
'it': "Versione #️⃣",
|
||||
'all_packages_updated': {
|
||||
'en': "⌛️ All packages are updated! ✅",
|
||||
'it': "⌛️ Tutti i pacchetti sono aggiornati! ✅",
|
||||
},
|
||||
'checking_for_updates': {
|
||||
'en': "⏳ Checking for updates... ☑️",
|
||||
'it': "⏳ Sto cercando aggiornamenti... ☑️",
|
||||
},
|
||||
'description': {
|
||||
'en': "Get packages version and source code last commit",
|
||||
'it': "Chiedi la versione dei pacchetti e del codice sorgente",
|
||||
},
|
||||
'help_section': None,
|
||||
'header': {
|
||||
'en': "ℹ️ Version information #️⃣\n\n"
|
||||
"Last commit: <code>{last_commit}</code>",
|
||||
'it': "ℹ️ Informazioni sulle versioni dei pacchetti #️⃣\n\n"
|
||||
"Ultimo commit: <code>{last_commit}</code>"
|
||||
},
|
||||
'help_section': None,
|
||||
'reply_keyboard_button': {
|
||||
'en': "Version #️⃣",
|
||||
'it': "Versione #️⃣",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user