diff --git a/royalnet/commands/__init__.py b/royalnet/commands/__init__.py index a3e7af1b..10a6d444 100644 --- a/royalnet/commands/__init__.py +++ b/royalnet/commands/__init__.py @@ -21,9 +21,10 @@ from .play import PlayCommand from .skip import SkipCommand from .playmode import PlaymodeCommand from .videochannel import VideochannelCommand +from .missing import MissingCommand __all__ = ["NullCommand", "PingCommand", "ShipCommand", "SmecdsCommand", "CiaoruoziCommand", "ColorCommand", "SyncCommand", "DiarioCommand", "RageCommand", "DateparserCommand", "AuthorCommand", "ReminderCommand", "KvactiveCommand", "KvCommand", "KvrollCommand", "VideoinfoCommand", "SummonCommand", "PlayCommand", - "SkipCommand", "PlaymodeCommand", "VideochannelCommand"] + "SkipCommand", "PlaymodeCommand", "VideochannelCommand", "MissingCommand"] diff --git a/royalnet/commands/missing.py b/royalnet/commands/missing.py new file mode 100644 index 00000000..d5eb8392 --- /dev/null +++ b/royalnet/commands/missing.py @@ -0,0 +1,17 @@ +import asyncio +import logging as _logging +from ..utils import Command, Call + +loop = asyncio.get_event_loop() +log = _logging.getLogger(__name__) + + +class MissingCommand(Command): + + command_name = "missing" + command_description = "Informa che il comando non esiste." + command_syntax = "" + + @classmethod + async def common(cls, call: Call): + await call.reply(f"⚠️ Il comando richiesto non esiste.") diff --git a/royalnet/royalgames.py b/royalnet/royalgames.py index 6c15f15b..6b57f58f 100644 --- a/royalnet/royalgames.py +++ b/royalnet/royalgames.py @@ -15,7 +15,7 @@ log = logging.root stream_handler = logging.StreamHandler() stream_handler.formatter = logging.Formatter("{asctime}\t{name}\t{levelname}\t{message}", style="{") log.addHandler(stream_handler) -log.setLevel(logging.WARNING) +log.setLevel(logging.INFO) commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziCommand, DebugCreateCommand, SyncCommand, AuthorCommand, DiarioCommand, RageCommand, DateparserCommand, ReminderCommand, KvactiveCommand, KvCommand, @@ -29,12 +29,14 @@ ds_bot = DiscordBot(discord_config=DiscordConfig(os.environ["DS_AK"]), royalnet_config=RoyalnetConfig(f"ws://{address}:{port}", "sas"), database_config=DatabaseConfig(os.environ["DB_PATH"], Royal, Discord, "discord_id"), commands=commands, - error_command=ErrorHandlerCommand) + error_command=ErrorHandlerCommand, + missing_command=MissingCommand) tg_bot = TelegramBot(telegram_config=TelegramConfig(os.environ["TG_AK"]), royalnet_config=RoyalnetConfig(f"ws://{address}:{port}", "sas"), database_config=DatabaseConfig(os.environ["DB_PATH"], Royal, Telegram, "tg_id"), commands=commands, - error_command=ErrorHandlerCommand) + error_command=ErrorHandlerCommand, + missing_command=MissingCommand) print(tg_bot.botfather_command_string) loop.run_until_complete(master.start()) loop.create_task(tg_bot.run())