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:
parent
0a4e2eaf3a
commit
7fa429335c
3 changed files with 24 additions and 4 deletions
|
@ -21,9 +21,10 @@ from .play import PlayCommand
|
||||||
from .skip import SkipCommand
|
from .skip import SkipCommand
|
||||||
from .playmode import PlaymodeCommand
|
from .playmode import PlaymodeCommand
|
||||||
from .videochannel import VideochannelCommand
|
from .videochannel import VideochannelCommand
|
||||||
|
from .missing import MissingCommand
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["NullCommand", "PingCommand", "ShipCommand", "SmecdsCommand", "CiaoruoziCommand", "ColorCommand",
|
__all__ = ["NullCommand", "PingCommand", "ShipCommand", "SmecdsCommand", "CiaoruoziCommand", "ColorCommand",
|
||||||
"SyncCommand", "DiarioCommand", "RageCommand", "DateparserCommand", "AuthorCommand", "ReminderCommand",
|
"SyncCommand", "DiarioCommand", "RageCommand", "DateparserCommand", "AuthorCommand", "ReminderCommand",
|
||||||
"KvactiveCommand", "KvCommand", "KvrollCommand", "VideoinfoCommand", "SummonCommand", "PlayCommand",
|
"KvactiveCommand", "KvCommand", "KvrollCommand", "VideoinfoCommand", "SummonCommand", "PlayCommand",
|
||||||
"SkipCommand", "PlaymodeCommand", "VideochannelCommand"]
|
"SkipCommand", "PlaymodeCommand", "VideochannelCommand", "MissingCommand"]
|
||||||
|
|
17
royalnet/commands/missing.py
Normal file
17
royalnet/commands/missing.py
Normal 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.")
|
|
@ -15,7 +15,7 @@ log = logging.root
|
||||||
stream_handler = logging.StreamHandler()
|
stream_handler = logging.StreamHandler()
|
||||||
stream_handler.formatter = logging.Formatter("{asctime}\t{name}\t{levelname}\t{message}", style="{")
|
stream_handler.formatter = logging.Formatter("{asctime}\t{name}\t{levelname}\t{message}", style="{")
|
||||||
log.addHandler(stream_handler)
|
log.addHandler(stream_handler)
|
||||||
log.setLevel(logging.WARNING)
|
log.setLevel(logging.INFO)
|
||||||
|
|
||||||
commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziCommand, DebugCreateCommand, SyncCommand,
|
commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziCommand, DebugCreateCommand, SyncCommand,
|
||||||
AuthorCommand, DiarioCommand, RageCommand, DateparserCommand, ReminderCommand, KvactiveCommand, KvCommand,
|
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"),
|
royalnet_config=RoyalnetConfig(f"ws://{address}:{port}", "sas"),
|
||||||
database_config=DatabaseConfig(os.environ["DB_PATH"], Royal, Discord, "discord_id"),
|
database_config=DatabaseConfig(os.environ["DB_PATH"], Royal, Discord, "discord_id"),
|
||||||
commands=commands,
|
commands=commands,
|
||||||
error_command=ErrorHandlerCommand)
|
error_command=ErrorHandlerCommand,
|
||||||
|
missing_command=MissingCommand)
|
||||||
tg_bot = TelegramBot(telegram_config=TelegramConfig(os.environ["TG_AK"]),
|
tg_bot = TelegramBot(telegram_config=TelegramConfig(os.environ["TG_AK"]),
|
||||||
royalnet_config=RoyalnetConfig(f"ws://{address}:{port}", "sas"),
|
royalnet_config=RoyalnetConfig(f"ws://{address}:{port}", "sas"),
|
||||||
database_config=DatabaseConfig(os.environ["DB_PATH"], Royal, Telegram, "tg_id"),
|
database_config=DatabaseConfig(os.environ["DB_PATH"], Royal, Telegram, "tg_id"),
|
||||||
commands=commands,
|
commands=commands,
|
||||||
error_command=ErrorHandlerCommand)
|
error_command=ErrorHandlerCommand,
|
||||||
|
missing_command=MissingCommand)
|
||||||
print(tg_bot.botfather_command_string)
|
print(tg_bot.botfather_command_string)
|
||||||
loop.run_until_complete(master.start())
|
loop.run_until_complete(master.start())
|
||||||
loop.create_task(tg_bot.run())
|
loop.create_task(tg_bot.run())
|
||||||
|
|
Loading…
Reference in a new issue