1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Some voice changes, add voicestatus command

This commit is contained in:
Steffo 2020-03-28 21:51:21 +01:00
parent dea29e6d6d
commit c80c5a33db
3 changed files with 47 additions and 1 deletions

View file

@ -38,6 +38,7 @@ from .magickfiorygi import MagickfiorygiCommand
from .brawlhalla import BrawlhallaCommand
from .diarioshuffle import DiarioshuffleCommand
from .funkwhaleplaylist import FunkwhaleplaylistCommand
from .voicestatus import VoicestatusCommand
# Enter the commands of your Pack here!
available_commands = [
@ -80,6 +81,7 @@ available_commands = [
BrawlhallaCommand,
DiarioshuffleCommand,
FunkwhaleplaylistCommand,
VoicestatusCommand,
]
# Don't change this, it should automatically generate __all__

View file

@ -11,7 +11,7 @@ class QueueCommand(Command):
aliases = ["q"]
description: str = "Visualizza la coda di riproduzione attuale.."
description: str = "Visualizza la coda di riproduzione attuale."
async def run(self, args: CommandArgs, data: CommandData) -> None:
if self.interface.name == "discord":

View file

@ -0,0 +1,44 @@
from typing import *
import royalnet.serf.discord as rsd
import royalnet.commands as rc
class VoicestatusCommand(rc.Command):
name: str = "voicestatus"
description: str = "Visualizza lo stato interno dei voice player del bot."
syntax: str = ""
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
if self.interface.name != "discord":
raise rc.UnsupportedError("Questo comando funziona solo su Discord.")
serf: rsd.DiscordSerf = self.interface.serf
message = []
for index, voice_player in enumerate(serf.voice_players):
message.append(f"🎵 [b]Voice Player #{index}[/b]")
voice_client = voice_player.voice_client
if voice_client.is_connected():
message.append(f"🔵 Connected")
else:
message.append(f"🔴 Disconnected")
if voice_client.is_playing():
message.append(f"🔵 Playing")
else:
message.append(f"⚪ Not playing")
if voice_client.is_paused():
message.append(f"⚪ Paused")
else:
message.append(f"🔵 Not paused")
playable = voice_player.playing
message.append(f"🔉 {playable.__class__.__name__}")
message.append("")
if len(serf.voice_players) == 0:
message.append("[i]Nessun voice player.[/i]")
await data.reply("\n".join(message))