mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Add id command
This commit is contained in:
parent
51ff4e59dd
commit
717bcc12ae
3 changed files with 29 additions and 2 deletions
|
@ -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"]
|
||||
|
|
25
royalnet/commands/id.py
Normal file
25
royalnet/commands/id.py
Normal file
|
@ -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.")
|
|
@ -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__:
|
||||
|
|
Loading…
Reference in a new issue