diff --git a/royalnet/commands/__init__.py b/royalnet/commands/__init__.py index 03346716..f353c19e 100644 --- a/royalnet/commands/__init__.py +++ b/royalnet/commands/__init__.py @@ -28,10 +28,11 @@ from .cv import CvCommand from .pause import PauseCommand from .queue import QueueCommand from .royalnetprofile import RoyalnetprofileCommand +from .id import IdCommand __all__ = ["NullCommand", "PingCommand", "ShipCommand", "SmecdsCommand", "CiaoruoziCommand", "ColorCommand", "SyncCommand", "DiarioCommand", "RageCommand", "DateparserCommand", "AuthorCommand", "ReminderCommand", "KvactiveCommand", "KvCommand", "KvrollCommand", "VideoinfoCommand", "SummonCommand", "PlayCommand", "SkipCommand", "PlaymodeCommand", "VideochannelCommand", "MissingCommand", "CvCommand", "PauseCommand", - "QueueCommand", "RoyalnetprofileCommand"] + "QueueCommand", "RoyalnetprofileCommand", "IdCommand"] diff --git a/royalnet/commands/id.py b/royalnet/commands/id.py new file mode 100644 index 00000000..27dc2de5 --- /dev/null +++ b/royalnet/commands/id.py @@ -0,0 +1,25 @@ +import telegram +import discord +import typing +from ..utils import Command, Call + +class IdCommand(Command): + + command_name = "id" + command_description = "Visualizza l'id della chat attuale." + command_syntax = "" + + @classmethod + def telegram(cls, call: Call): + chat: telegram.Chat = call.channel + call.reply(f"🔢 L'id di questa chat è [b]{chat.id}[/b].") + + @classmethod + def discord(cls, call: Call): + channel = call.channel + if isinstance(channel, discord.TextChannel): + call.reply(f"🔢 L'id di questa chat è [b]{channel.id}[/b].") + elif isinstance(channel, discord.DMChannel): + call.reply(f"🔢 L'id di questa chat è [b]{channel.id}[/b].") + else: + call.reply(f"⚠️ Questo tipo di chat non è supportato.") diff --git a/royalnet/royalgames.py b/royalnet/royalgames.py index 5a97773b..dc8c843b 100644 --- a/royalnet/royalgames.py +++ b/royalnet/royalgames.py @@ -23,7 +23,8 @@ log.setLevel(logging.INFO) commands = [PingCommand, ShipCommand, SmecdsCommand, ColorCommand, CiaoruoziCommand, SyncCommand, DiarioCommand, RageCommand, ReminderCommand, KvactiveCommand, KvCommand, KvrollCommand, SummonCommand, PlayCommand, SkipCommand, PlaymodeCommand, - VideochannelCommand, CvCommand, PauseCommand, QueueCommand, RoyalnetprofileCommand, VideoinfoCommand] + VideochannelCommand, CvCommand, PauseCommand, QueueCommand, RoyalnetprofileCommand, VideoinfoCommand, + IdCommand] # noinspection PyUnreachableCode if __debug__: