Multilanguage support for unknown command and authorization denied messages
This commit is contained in:
parent
757fa158b6
commit
0f5ca87947
@ -3,7 +3,7 @@
|
|||||||
__author__ = "Davide Testa"
|
__author__ = "Davide Testa"
|
||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "1.1.12"
|
__version__ = "1.1.13"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import sys
|
|||||||
import davtelepot
|
import davtelepot
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from . import ciclopi
|
from . import ciclopi, messages
|
||||||
from .data.passwords import bot_token
|
from .data.passwords import bot_token
|
||||||
from .messages import (
|
from .messages import (
|
||||||
default_help_messages, language_messages, supported_languages
|
default_help_messages, language_messages, supported_languages
|
||||||
@ -73,11 +73,10 @@ if __name__ == '__main__':
|
|||||||
bot.set_class_log_file_name(log_file_name)
|
bot.set_class_log_file_name(log_file_name)
|
||||||
bot.set_class_errors_file_name(errors_file_name)
|
bot.set_class_errors_file_name(errors_file_name)
|
||||||
bot.set_unknown_command_message(
|
bot.set_unknown_command_message(
|
||||||
"Comando sconosciuto!\n"
|
messages.unknown_command_message
|
||||||
"Scrivi /help per visualizzare la guida."
|
|
||||||
)
|
)
|
||||||
bot.set_authorization_denied_message(
|
bot.set_authorization_denied_message(
|
||||||
"Non disponi di autorizzazioni sufficienti per questo comando."
|
messages.authorization_denied_message
|
||||||
)
|
)
|
||||||
with bot.db as db:
|
with bot.db as db:
|
||||||
db['users'].upsert(
|
db['users'].upsert(
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
"""Default messages for bot functions."""
|
"""Default messages for bot functions."""
|
||||||
|
|
||||||
|
authorization_denied_message = {
|
||||||
|
'en': "You are not allowed to use this command, sorry.",
|
||||||
|
'it': "Non disponi di autorizzazioni sufficienti per questa richiesta, spiacente.",
|
||||||
|
}
|
||||||
|
|
||||||
language_messages = {
|
language_messages = {
|
||||||
'language_command': {
|
'language_command': {
|
||||||
'name': {
|
'name': {
|
||||||
@ -496,3 +501,8 @@ default_help_messages = {
|
|||||||
'it': "Comandi 🤖",
|
'it': "Comandi 🤖",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unknown_command_message = {
|
||||||
|
'en': "Unknown command! Touch /help to read the guide and available commands.",
|
||||||
|
'it': "Comando sconosciuto! Fai /help per leggere la guida e i comandi."
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user