diff options
author | Parker <contact@pkrm.dev> | 2024-06-26 14:35:55 -0500 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-06-26 14:35:55 -0500 |
commit | 654707368497990b716253e1c31131f43c2e4c12 (patch) | |
tree | bfc11bc4251dc6f2fd57a2bf64f19d472a53b4e6 /code/cogs/slash_handlers.py | |
parent | 847a828c52b9d7b6c79f86944acf1a967faf4147 (diff) |
Comments and cleanup
Diffstat (limited to 'code/cogs/slash_handlers.py')
-rw-r--r-- | code/cogs/slash_handlers.py | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/code/cogs/slash_handlers.py b/code/cogs/slash_handlers.py index e36a5cc..ebe4a81 100644 --- a/code/cogs/slash_handlers.py +++ b/code/cogs/slash_handlers.py @@ -3,6 +3,7 @@ from discord.ext import commands from discord import app_commands from discord.ext.commands.errors import * import datetime +from lavalink import errors from global_variables import BOT_COLOR, CheckPlayerError from custom_source import LoadError @@ -30,22 +31,8 @@ class slash_handlers(commands.Cog): if isinstance(error, CommandNotFound): return - # elif isinstance(error, app_commands.MissingPermissions): - # embed = discord.Embed( - # title="Missing Permissions!", - # description=f"{error}", - # color=BOT_COLOR - # ) - # await interaction.response.send_message(embed=embed, ephemeral=True) - - # elif isinstance(error, app_commands.BotMissingPermissions): - # embed = discord.Embed( - # title="Bot Missing Permissions!", - # description=f"{error}", - # color=BOT_COLOR - # ) - # await interaction.response.send_message(embed=embed, ephemeral=True) - + # Custom Error class for the `create_player` function + # Issues that arise may be user not in vc, user not in correct vc, missing perms, etc. elif isinstance(error, CheckPlayerError): embed = discord.Embed( title=error.info["title"], @@ -60,6 +47,8 @@ class slash_handlers(commands.Cog): ) await interaction.response.send_message(embed=embed, ephemeral=True) + # If a player cannot be created for any of the music commands + # Player creation is a command check for every music command elif ( isinstance(error, app_commands.CheckFailure) and interaction.command.name in music_commands @@ -77,6 +66,7 @@ class slash_handlers(commands.Cog): ) await interaction.response.send_message(embed=embed, ephemeral=True) + # If a Spotify song is linked but cannot be found on a provider (e.g. YouTube) elif isinstance(error, LoadError): embed = discord.Embed( title="Nothing Found", |