Comments and cleanup
This commit is contained in:
parent
847a828c52
commit
6547073684
@ -3,6 +3,7 @@ from discord.ext import commands
|
|||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord.ext.commands.errors import *
|
from discord.ext.commands.errors import *
|
||||||
import datetime
|
import datetime
|
||||||
|
from lavalink import errors
|
||||||
|
|
||||||
from global_variables import BOT_COLOR, CheckPlayerError
|
from global_variables import BOT_COLOR, CheckPlayerError
|
||||||
from custom_source import LoadError
|
from custom_source import LoadError
|
||||||
@ -30,22 +31,8 @@ class slash_handlers(commands.Cog):
|
|||||||
if isinstance(error, CommandNotFound):
|
if isinstance(error, CommandNotFound):
|
||||||
return
|
return
|
||||||
|
|
||||||
# elif isinstance(error, app_commands.MissingPermissions):
|
# Custom Error class for the `create_player` function
|
||||||
# embed = discord.Embed(
|
# Issues that arise may be user not in vc, user not in correct vc, missing perms, etc.
|
||||||
# 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)
|
|
||||||
|
|
||||||
elif isinstance(error, CheckPlayerError):
|
elif isinstance(error, CheckPlayerError):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title=error.info["title"],
|
title=error.info["title"],
|
||||||
@ -60,6 +47,8 @@ class slash_handlers(commands.Cog):
|
|||||||
)
|
)
|
||||||
await interaction.response.send_message(embed=embed, ephemeral=True)
|
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 (
|
elif (
|
||||||
isinstance(error, app_commands.CheckFailure)
|
isinstance(error, app_commands.CheckFailure)
|
||||||
and interaction.command.name in music_commands
|
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)
|
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):
|
elif isinstance(error, LoadError):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Nothing Found",
|
title="Nothing Found",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user