mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Fix skip, queue and pause crashing the bot
This commit is contained in:
parent
877fad5b2b
commit
96fff959a8
3 changed files with 9 additions and 6 deletions
|
@ -23,10 +23,11 @@ class DiscordPauseEvent(Event):
|
||||||
guild: discord.Guild = client.get_guild(guild_id)
|
guild: discord.Guild = client.get_guild(guild_id)
|
||||||
if guild is None:
|
if guild is None:
|
||||||
raise InvalidInputError("Impossibile trovare il Server specificato.")
|
raise InvalidInputError("Impossibile trovare il Server specificato.")
|
||||||
voice_player: VoicePlayer = self.serf.find_voice_player(guild)
|
voice_players = self.serf.find_voice_players(guild)
|
||||||
if voice_player is None:
|
if len(voice_players):
|
||||||
raise UserError("Il bot non è in nessun canale vocale.\n"
|
raise UserError("Il bot non è in nessun canale vocale.\n"
|
||||||
"Evocalo prima con [c]summon[/c]!")
|
"Evocalo prima con [c]summon[/c]!")
|
||||||
|
voice_player = voice_players[0]
|
||||||
|
|
||||||
if voice_player.voice_client.is_paused():
|
if voice_player.voice_client.is_paused():
|
||||||
voice_player.voice_client.resume()
|
voice_player.voice_client.resume()
|
||||||
|
|
|
@ -26,10 +26,11 @@ class DiscordQueueEvent(Event):
|
||||||
guild: discord.Guild = client.get_guild(guild_id)
|
guild: discord.Guild = client.get_guild(guild_id)
|
||||||
if guild is None:
|
if guild is None:
|
||||||
raise InvalidInputError("Impossibile trovare il Server specificato.")
|
raise InvalidInputError("Impossibile trovare il Server specificato.")
|
||||||
voice_player: VoicePlayer = self.serf.find_voice_player(guild)
|
voice_players = self.serf.find_voice_players(guild)
|
||||||
if voice_player is None:
|
if len(voice_players):
|
||||||
raise UserError("Il bot non è in nessun canale vocale.\n"
|
raise UserError("Il bot non è in nessun canale vocale.\n"
|
||||||
"Evocalo prima con [c]summon[/c]!")
|
"Evocalo prima con [c]summon[/c]!")
|
||||||
|
voice_player = voice_players[0]
|
||||||
if isinstance(voice_player.playing, RoyalQueue):
|
if isinstance(voice_player.playing, RoyalQueue):
|
||||||
now_playing = voice_player.playing.now_playing
|
now_playing = voice_player.playing.now_playing
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -23,10 +23,11 @@ class DiscordSkipEvent(Event):
|
||||||
guild: discord.Guild = client.get_guild(guild_id)
|
guild: discord.Guild = client.get_guild(guild_id)
|
||||||
if guild is None:
|
if guild is None:
|
||||||
raise InvalidInputError("Impossibile trovare il Server specificato.")
|
raise InvalidInputError("Impossibile trovare il Server specificato.")
|
||||||
voice_player: VoicePlayer = self.serf.find_voice_player(guild)
|
voice_players = self.serf.find_voice_players(guild)
|
||||||
if voice_player is None:
|
if len(voice_players):
|
||||||
raise UserError("Il bot non è in nessun canale vocale.\n"
|
raise UserError("Il bot non è in nessun canale vocale.\n"
|
||||||
"Evocalo prima con [c]summon[/c]!")
|
"Evocalo prima con [c]summon[/c]!")
|
||||||
|
voice_player = voice_players[0]
|
||||||
# Stop the playback of the current song
|
# Stop the playback of the current song
|
||||||
voice_player.voice_client.stop()
|
voice_player.voice_client.stop()
|
||||||
# Done!
|
# Done!
|
||||||
|
|
Loading…
Reference in a new issue