diff options
Diffstat (limited to 'code/cogs')
-rw-r--r-- | code/cogs/owner/toggle.py | 35 | ||||
-rw-r--r-- | code/cogs/play.py | 18 |
2 files changed, 52 insertions, 1 deletions
diff --git a/code/cogs/owner/toggle.py b/code/cogs/owner/toggle.py new file mode 100644 index 0000000..2ab6944 --- /dev/null +++ b/code/cogs/owner/toggle.py @@ -0,0 +1,35 @@ +from discord.ext import commands +from typing import Literal + +import utils.config as config + + +class Toggle(commands.Cog): + def __init__(self, bot): + self.bot = bot + + @commands.command() + @commands.dm_only() + @commands.is_owner() + async def toggle( + self, ctx, action: Literal["disable", "enable", "broken"] + ): + """Toggle YouTube links""" + if action == "disable": + config.YOUTUBE_SUPPORT = False + config.YOUTUBE_BROKEN = False + return await ctx.send("YouTube has been disabled.") + + if action == "enable": + config.YOUTUBE_SUPPORT = True + config.YOUTUBE_BROKEN = False + return await ctx.send("YouTube has been enabled.") + + if action == "broken": + config.YOUTUBE_SUPPORT = False + config.YOUTUBE_BROKEN = True + return await ctx.send("YouTube has been marked as broken.") + + +async def setup(bot): + await bot.add_cog(Toggle(bot)) diff --git a/code/cogs/play.py b/code/cogs/play.py index 76704ac..5ff1eb6 100644 --- a/code/cogs/play.py +++ b/code/cogs/play.py @@ -6,7 +6,7 @@ from lavalink import LoadType import re from cogs.music import Music, LavalinkVoiceClient -from utils.config import YOUTUBE_SUPPORT, create_embed +from utils.config import YOUTUBE_SUPPORT, YOUTUBE_BROKEN, create_embed from utils.custom_sources import ( LoadError, CustomAudioTrack, @@ -45,6 +45,22 @@ class Play(commands.Cog): embed=embed, ephemeral=True ) + if YOUTUBE_BROKEN: + embed = create_embed( + title="YouTube Broken", + description=( + "YouTube support is currently broken. This is a known" + " issue and is being actively worked on, please try" + " again later. Other sources should still be in" + " working order. Submit a bug report with " + " </bug:1224840889906499626> if issues persist. Sorry" + " for the inconvenience." + ), + ) + return await interaction.response.send_message( + embed=embed, ephemeral=True + ) + # Check for custom sources (Apple Music/Spotify) if "music.apple.com" in query: results, embed = await parse_custom_source( |