From c517b95f7cb0b1cc3ec474e291df6406438c2262 Mon Sep 17 00:00:00 2001 From: Valerie Date: Wed, 28 May 2025 02:21:10 -0400 Subject: [PATCH] Add global configuration option to toggle audioset notify command and update command handling in ExtendedAudio cog This commit introduces a new global configuration option to enable or disable the audioset notify command. A new command, `togglenotify`, is added for the bot owner to manage this setting. Additionally, the command handling is updated to block the audioset notify command when it is disabled, directing users to use ExtendedAudio's notification features instead. --- extendedaudio/extendedaudio.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/extendedaudio/extendedaudio.py b/extendedaudio/extendedaudio.py index cf13d15..8f3942a 100644 --- a/extendedaudio/extendedaudio.py +++ b/extendedaudio/extendedaudio.py @@ -36,7 +36,11 @@ class ExtendedAudio(commands.Cog): "last_status_message": None, # ID of the last status message (for cleanup) "clean_old_messages": True, # Whether to delete old status messages } + default_global = { + "disable_notify_command": True, # Whether to disable the audioset notify command + } self.config.register_guild(**default_guild) + self.config.register_global(**default_global) self.task = self.bot.loop.create_task(self.initialize()) self.audio = None @@ -376,11 +380,30 @@ class ExtendedAudio(commands.Cog): except Exception as e: log.error(f"Error resetting channel name on stop: {e}") + @commands.command() + @commands.is_owner() + async def togglenotify(self, ctx: commands.Context): + """Toggle whether the audioset notify command should be disabled. + + This command is bot owner only. + When disabled, users will be directed to use ExtendedAudio's notification features instead. + """ + current = await self.config.disable_notify_command() + await self.config.disable_notify_command.set(not current) + state = "disabled" if not current else "enabled" + await ctx.send(f"The audioset notify command is now {state}.") + async def cog_before_invoke(self, ctx: commands.Context): """Check if the voice channel can be used before any audio command.""" if not ctx.guild: return True + # Check if we should block audioset notify + if await self.config.disable_notify_command(): + if ctx.command.qualified_name == "audioset notify": + await ctx.send("This command is disabled. Please use the ExtendedAudio cog's notification features instead.") + return False + # Only check audio-related commands if not self.audio or ctx.cog != self.audio: return True