Catch new CreatePlayerError
and LoadError
This commit is contained in:
parent
781d9ad7b2
commit
8c53a7398a
@ -5,6 +5,8 @@ from discord.ext.commands.errors import *
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from global_variables import BOT_COLOR
|
from global_variables import BOT_COLOR
|
||||||
|
from cogs.music import CreatePlayerError
|
||||||
|
from custom_source import LoadError
|
||||||
|
|
||||||
|
|
||||||
class slash_handlers(commands.Cog):
|
class slash_handlers(commands.Cog):
|
||||||
@ -45,10 +47,7 @@ class slash_handlers(commands.Cog):
|
|||||||
# )
|
# )
|
||||||
# await interaction.response.send_message(embed=embed, ephemeral=True)
|
# await interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
|
||||||
elif (
|
elif isinstance(error, CreatePlayerError):
|
||||||
isinstance(error, app_commands.AppCommandError)
|
|
||||||
and interaction.command.name in music_commands
|
|
||||||
):
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title=error.args[0]["title"],
|
title=error.args[0]["title"],
|
||||||
description=error.args[0]["description"],
|
description=error.args[0]["description"],
|
||||||
@ -79,6 +78,20 @@ class slash_handlers(commands.Cog):
|
|||||||
)
|
)
|
||||||
await interaction.response.send_message(embed=embed, ephemeral=True)
|
await interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
|
||||||
|
elif isinstance(error, LoadError):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Nothing Found",
|
||||||
|
description="Spotify does not allow direct play, meaning songs have to be found on a supported provider. In this case, the song couldn't be found. Please try again with a different song, or try searching for just the name and artist manually rather than sending a link.",
|
||||||
|
color=BOT_COLOR,
|
||||||
|
)
|
||||||
|
embed.set_footer(
|
||||||
|
text=datetime.datetime.now(datetime.timezone.utc).strftime(
|
||||||
|
"%Y-%m-%d %H:%M:%S"
|
||||||
|
)
|
||||||
|
+ " UTC"
|
||||||
|
)
|
||||||
|
await interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise error
|
raise error
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user