|
@@ -7,7 +7,7 @@ import sys
|
|
|
|
|
|
# Third party modules
|
|
# Third party modules
|
|
import davtelepot
|
|
import davtelepot
|
|
-from davtelepot import authorization
|
|
|
|
|
|
+from davtelepot import authorization, languages
|
|
|
|
|
|
# Project modules
|
|
# Project modules
|
|
from . import bot_tools
|
|
from . import bot_tools
|
|
@@ -15,6 +15,47 @@ from . import ciclopi
|
|
from . import helper
|
|
from . import helper
|
|
from .data.passwords import bot_token
|
|
from .data.passwords import bot_token
|
|
|
|
|
|
|
|
+language_messages = {
|
|
|
|
+ 'language_command': {
|
|
|
|
+ 'name': {
|
|
|
|
+ 'en': "/language",
|
|
|
|
+ 'it': "/lingua"
|
|
|
|
+ },
|
|
|
|
+ 'alias': {
|
|
|
|
+ 'en': "Language 🗣",
|
|
|
|
+ 'it': "Lingua 🗣"
|
|
|
|
+ },
|
|
|
|
+ 'description': {
|
|
|
|
+ 'en': "Change language settings",
|
|
|
|
+ 'it': "Cambia le impostazioni della lingua"
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ 'language_button': {
|
|
|
|
+ 'description': {
|
|
|
|
+ 'en': "Change language settings",
|
|
|
|
+ 'it': "Cambia le impostazioni della lingua"
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ 'language_panel': {
|
|
|
|
+ 'text': {
|
|
|
|
+ 'en': "<b>Choose a language</b>",
|
|
|
|
+ 'it': "<b>Seleziona una lingua</b>"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+supported_languages = {
|
|
|
|
+ 'en': {
|
|
|
|
+ 'flag': '🇬🇧',
|
|
|
|
+ 'name': 'English'
|
|
|
|
+ },
|
|
|
|
+ 'it': {
|
|
|
|
+ 'flag': '🇮🇹',
|
|
|
|
+ 'name': 'Italiano'
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
path = os.path.dirname(__file__)
|
|
path = os.path.dirname(__file__)
|
|
try:
|
|
try:
|
|
@@ -88,6 +129,10 @@ if __name__ == '__main__':
|
|
help_sections_file='ciclopibot/data/help.json'
|
|
help_sections_file='ciclopibot/data/help.json'
|
|
)
|
|
)
|
|
authorization.init(bot, language='it')
|
|
authorization.init(bot, language='it')
|
|
|
|
+ languages.init(
|
|
|
|
+ bot, language='it', language_messages=language_messages,
|
|
|
|
+ supported_languages=supported_languages
|
|
|
|
+ )
|
|
# Run bot(s)
|
|
# Run bot(s)
|
|
logging.info("Presso ctrl+C to exit.")
|
|
logging.info("Presso ctrl+C to exit.")
|
|
exit_state = davtelepot.bot.Bot.run(
|
|
exit_state = davtelepot.bot.Bot.run(
|