From 760aac506f65f3d4c6765f545ad6444bd086b859 Mon Sep 17 00:00:00 2001 From: Parker Date: Sun, 14 Apr 2024 20:31:05 -0500 Subject: Create/Implement `CheckPlayerError` error class --- code/cogs/music.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'code/cogs/music.py') diff --git a/code/cogs/music.py b/code/cogs/music.py index 7a3418c..729284d 100644 --- a/code/cogs/music.py +++ b/code/cogs/music.py @@ -8,6 +8,7 @@ from global_variables import ( LAVALINK_PASSWORD, LAVALINK_PORT, LOG, + CheckPlayerError, ) from ai_recommendations import add_song_recommendations @@ -135,14 +136,14 @@ class Music(commands.Cog): if not interaction.user.voice or not interaction.user.voice.channel: if voice_client is not None: - raise app_commands.AppCommandError( + raise CheckPlayerError( { "title": "Not in my VC", "description": "You must join my voice channel to run that command.", } ) - raise app_commands.AppCommandError( + raise CheckPlayerError( { "title": "No Channel", "description": "You must join a voice channel before you can run that command.", @@ -151,7 +152,7 @@ class Music(commands.Cog): if voice_client is None: if not should_connect: - raise app_commands.AppCommandError( + raise CheckPlayerError( { "title": "Not Connected", "description": "I am not connected and playing music right now, therefore that command will not work.", @@ -163,7 +164,7 @@ class Music(commands.Cog): ) if not permissions.connect or not permissions.speak: - raise app_commands.AppCommandError( + raise CheckPlayerError( { "title": "Missing Permissions", "description": "I need the `CONNECT` and `SPEAK` permissions in order to work.", @@ -173,7 +174,7 @@ class Music(commands.Cog): player.store("channel", interaction.channel.id) else: if int(player.channel_id) != interaction.user.voice.channel.id: - raise app_commands.AppCommandError( + raise CheckPlayerError( { "title": "Not in my VC", "description": "You must join my voice channel to run that command.", -- cgit v1.2.3-70-g09d2