1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add "missing" command

This commit is contained in:
Steffo 2019-05-05 15:36:53 +02:00
parent 0a4e2eaf3a
commit 7fa429335c
3 changed files with 24 additions and 4 deletions

View file

@ -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"]

View file

@ -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.")

View file

@ -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())