diff --git a/royalgames.py b/royalgames.py index 5736ad59..d9be4d73 100644 --- a/royalgames.py +++ b/royalgames.py @@ -17,5 +17,7 @@ master = RoyalnetServer("localhost", 1234, "sas") tg_bot = TelegramBot(os.environ["TG_AK"], "localhost:1234", "sas", commands, os.environ["DB_PATH"], Royal, Telegram, "tg_id", error_command=ErrorHandlerCommand) loop.create_task(master.run()) loop.create_task(tg_bot.run()) +print("Commands enabled:") +print(tg_bot.generate_botfather_command_string()) print("Starting loop...") loop.run_forever() diff --git a/royalnet/bots/telegram.py b/royalnet/bots/telegram.py index db75f204..2d32564d 100644 --- a/royalnet/bots/telegram.py +++ b/royalnet/bots/telegram.py @@ -136,5 +136,12 @@ class TelegramBot: except Exception as exc2: log.error(f"Exception in error handler command: {exc2}") + def generate_botfather_command_string(self): + string = "" + for command_key in self.commands: + command = self.commands[command_key] + string += f"{command.command_name} - {command.command_description}\n" + return string + async def handle_net_request(self, message: Message): pass diff --git a/royalnet/commands/ciaoruozi.py b/royalnet/commands/ciaoruozi.py index 1174ce2d..b30169e2 100644 --- a/royalnet/commands/ciaoruozi.py +++ b/royalnet/commands/ciaoruozi.py @@ -5,7 +5,7 @@ from telegram import Update, User class CiaoruoziCommand(Command): command_name = "ciaoruozi" - command_title = "Saluta Ruozi, anche se non è più in RYG." + command_description = "Saluta Ruozi, anche se non è più in RYG." command_syntax = "" async def telegram(self, call: Call): diff --git a/royalnet/commands/color.py b/royalnet/commands/color.py index d43d7332..62daa487 100644 --- a/royalnet/commands/color.py +++ b/royalnet/commands/color.py @@ -4,7 +4,7 @@ from ..utils import Command, CommandArgs, Call class ColorCommand(Command): command_name = "color" - command_title = "Invia un colore in chat...?" + command_description = "Invia un colore in chat...?" command_syntax = "" async def common(self, call: Call): diff --git a/royalnet/commands/debug_author.py b/royalnet/commands/debug_author.py index 0c7bfdcd..7d3f4a78 100644 --- a/royalnet/commands/debug_author.py +++ b/royalnet/commands/debug_author.py @@ -5,7 +5,7 @@ from ..database.tables import Royal, Telegram class DebugAuthorCommand(Command): command_name = "debug_author" - command_title = "Ottieni informazioni sull'autore di questa chiamata." + command_description = "Ottieni informazioni sull'autore di questa chiamata." command_syntax = "" require_alchemy_tables = {Royal, Telegram} diff --git a/royalnet/commands/debug_create.py b/royalnet/commands/debug_create.py index 46ddb39e..e99fd448 100644 --- a/royalnet/commands/debug_create.py +++ b/royalnet/commands/debug_create.py @@ -5,7 +5,7 @@ from ..database.tables import Royal, Alias class DebugCreateCommand(Command): command_name = "debug_create" - command_title = "Crea un nuovo account Royalnet" + command_description = "Crea un nuovo account Royalnet" command_syntax = "(newusername)" require_alchemy_tables = {Royal, Alias} diff --git a/royalnet/commands/diario.py b/royalnet/commands/diario.py index 56ee64ac..a19eafbe 100644 --- a/royalnet/commands/diario.py +++ b/royalnet/commands/diario.py @@ -13,7 +13,7 @@ from ..utils import asyncify class DiarioCommand(Command): command_name = "diario" - command_title = "Aggiungi una citazione al Diario." + command_description = "Aggiungi una citazione al Diario." command_syntax = "[!] \"(testo)\" --[autore], [contesto]" require_alchemy_tables = {Royal, Diario, Alias} diff --git a/royalnet/commands/error_handler.py b/royalnet/commands/error_handler.py index 7b93b601..1df8bf0a 100644 --- a/royalnet/commands/error_handler.py +++ b/royalnet/commands/error_handler.py @@ -6,7 +6,7 @@ from ..utils import Command, CommandArgs, Call, InvalidInputError, UnsupportedEr class ErrorHandlerCommand(Command): command_name = "error_handler" - command_title = "Gestisce gli errori causati dagli altri comandi." + command_description = "Gestisce gli errori causati dagli altri comandi." command_syntax = "" async def common(self, call: Call): diff --git a/royalnet/commands/null.py b/royalnet/commands/null.py index baa97875..29811f57 100644 --- a/royalnet/commands/null.py +++ b/royalnet/commands/null.py @@ -4,7 +4,7 @@ from ..utils import Command, CommandArgs, Call class NullCommand(Command): command_name = "null" - command_title = "Non fa nulla." + command_description = "Non fa nulla." command_syntax = "" async def common(self, call: Call): diff --git a/royalnet/commands/ping.py b/royalnet/commands/ping.py index c5a70fbb..9ecb5a41 100644 --- a/royalnet/commands/ping.py +++ b/royalnet/commands/ping.py @@ -4,7 +4,7 @@ from ..utils import Command, CommandArgs, Call class PingCommand(Command): command_name = "ping" - command_title = "Ping pong!" + command_description = "Ping pong!" command_syntax = "" async def common(self, call: Call): diff --git a/royalnet/commands/ship.py b/royalnet/commands/ship.py index 2734fd7a..779d319a 100644 --- a/royalnet/commands/ship.py +++ b/royalnet/commands/ship.py @@ -8,7 +8,7 @@ SHIP_RESULT = "💕 {one} + {two} = [b]{result}[/b]" class ShipCommand(Command): command_name = "ship" - command_title = "Crea una ship tra due cose." + command_description = "Crea una ship tra due cose." command_syntax = "(uno) (due)" async def common(self, call: Call): diff --git a/royalnet/commands/smecds.py b/royalnet/commands/smecds.py index 52d08659..437727e7 100644 --- a/royalnet/commands/smecds.py +++ b/royalnet/commands/smecds.py @@ -54,7 +54,7 @@ SMECDS = "🤔 Secondo me, è colpa {ds}." class SmecdsCommand(Command): command_name = "smecds" - command_title = "Secondo me, è colpa dello stagista..." + command_description = "Secondo me, è colpa dello stagista..." command_syntax = "" async def common(self, call: Call): diff --git a/royalnet/commands/sync.py b/royalnet/commands/sync.py index 9f2e287b..4ffa2820 100644 --- a/royalnet/commands/sync.py +++ b/royalnet/commands/sync.py @@ -7,7 +7,7 @@ from ..database.tables import Royal, Telegram class SyncCommand(Command): command_name = "sync" - command_title = "Connetti il tuo account attuale a Royalnet!" + command_description = "Connetti il tuo account attuale a Royalnet!" command_syntax = "(royalnetusername)" require_alchemy_tables = {Royal, Telegram} diff --git a/royalnet/utils/command.py b/royalnet/utils/command.py index cdaaa99f..098f78d0 100644 --- a/royalnet/utils/command.py +++ b/royalnet/utils/command.py @@ -40,7 +40,7 @@ class Command: """A generic command, called from any source.""" command_name: str = NotImplemented - command_title: str = NotImplemented + command_description: str = NotImplemented command_syntax: str = NotImplemented require_alchemy_tables: typing.Set = set()