diff options
author | Parker <contact@pkrm.dev> | 2024-11-28 00:04:48 -0600 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-11-28 00:04:48 -0600 |
commit | 382c42262954767acc3f5ee3e008e03acbfc4f26 (patch) | |
tree | 1617f4cf15e349d34408f71b07032ea7a6ba6594 /code/utils/command_tree.py | |
parent | 5eb665c99b1fcfaf9500daf7811f835d002e078e (diff) |
Overhaul \`play\` command
- Split custom sources into helper functions
- Add proper logging and handling
- Fix LoadError embed messsage
Diffstat (limited to 'code/utils/command_tree.py')
-rw-r--r-- | code/utils/command_tree.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/code/utils/command_tree.py b/code/utils/command_tree.py index 3d9214d..7ccb8b1 100644 --- a/code/utils/command_tree.py +++ b/code/utils/command_tree.py @@ -84,31 +84,23 @@ class Tree(app_commands.CommandTree): except discord.errors.InteractionResponded: await interaction.followup.send(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 (error, LoadError): embed = discord.Embed( - title="Nothing Found", + title="Load Error", 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." + "Apple Music and Spotify do not allow direct playing from" + " their websites, and I was unable to load a track on a" + " valid source. Please try again." ), color=BOT_COLOR, ) - embed.set_footer( - text=datetime.datetime.now(datetime.timezone.utc).strftime( - "%Y-%m-%d %H:%M:%S" - ) - + " UTC" - ) + # Only send the error if the interaction is still valid try: await interaction.response.send_message( embed=embed, ephemeral=True ) except discord.errors.InteractionResponded: - await interaction.followup.send(embed=embed, ephemeral=True) + pass else: raise error |