From ab6d784f2d2390e4d952bf993985b78332ee82f8 Mon Sep 17 00:00:00 2001 From: Parker Date: Tue, 9 Apr 2024 00:19:28 -0500 Subject: [PATCH] Remove YT support --- code/cogs/play.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/code/cogs/play.py b/code/cogs/play.py index b61d567..895f5ab 100644 --- a/code/cogs/play.py +++ b/code/cogs/play.py @@ -24,23 +24,34 @@ class Play(commands.Cog): "Play a song from your favorite music provider" player = self.bot.lavalink.player_manager.get(interaction.guild.id) + # Notify users that YouTube and Apple Music links are not allowed + + if "youtube.com" in query or "youtu.be" in query: + embed = discord.Embed( + title="YouTube Not Supported", + description="Unfortunately, YouTube does not allow bots to stream from their platform. Try sending a link for a different platform, or simply type the name of the song and I will automatically find it on a supported platform.", + color=BOT_COLOR, + ) + return await interaction.response.send_message(embed=embed) + + if "music.apple.com" in query: + embed = discord.Embed( + title="Apple Music Not Supported", + description="Unfortunately, Apple Music does not allow bots to stream from their platform. Try sending a link for a different platform, or simply type the name of the song and I will automatically find it on a supported platform.", + color=BOT_COLOR, + ) + return await interaction.response.send_message(embed=embed) + if not url_rx.match(query): - ytsearch = f"ytsearch:{query}" + ytsearch = f"scsearch:{query}" results = await player.node.get_tracks(ytsearch) if not results.tracks or results.load_type in ( LoadType.EMPTY, LoadType.ERROR, ): - scsearch = f"scsearch:{query}" + scsearch = f"dzsearch:{query}" results = await player.node.get_tracks(scsearch) - - if not results.tracks or results.load_type in ( - LoadType.EMPTY, - LoadType.ERROR, - ): - dzsearch = f"dzsearch:{query}" - results = await player.node.get_tracks(dzsearch) else: results = await player.node.get_tracks(query)