Send error message if database could not be sent

This commit is contained in:
Davte
2020-06-20 15:31:42 +02:00
parent dfffbff7c6
commit 1c76c7d797
2 changed files with 15 additions and 15 deletions

View File

@@ -544,13 +544,9 @@ async def _send_bot_database(bot: Bot, user_record: OrderedDict, language: str):
language=language
)
)
if isinstance(sent_update, Exception):
return bot.get_message(
'admin', 'db_command', 'db_sent',
language=language
)
return bot.get_message(
'admin', 'db_command', 'db_sent',
'admin', 'db_command',
('error' if isinstance(sent_update, Exception) else 'db_sent'),
language=language
)

View File

@@ -37,9 +37,21 @@ default_admin_messages = {
'it': "🔄 Clicka di nuovo per confermare",
},
'db_command': {
'db_sent': {
'en': "Database sent.",
'it': "Database inviato.",
},
'description': {
'en': "Ask for bot database via Telegram",
'it': "Ricevi il database del bot via Telegram"
'it': "Ricevi il database del bot via Telegram",
},
'error': {
'en': "Error sending database.",
'it': "Errore durante l'invio del database.",
},
'file_caption': {
'en': "Here is bot database.",
'it': "Ecco il database!"
},
'not_sqlite': {
'en': "Only SQLite databases may be sent via Telegram, since they "
@@ -49,14 +61,6 @@ default_admin_messages = {
"in quanto composti di un solo file.\n"
"Questo bot ha invece un database `{db_type}`."
},
'file_caption': {
'en': "Here is bot database.",
'it': "Ecco il database!"
},
'db_sent': {
'en': "Database sent.",
'it': "Database inviato."
}
},
'error': {
'text': {