From 4fcd1bd83cb080f32c8c19f64aed7b5bd9d928ba Mon Sep 17 00:00:00 2001 From: "Tech. TTGames" <50541739+Tech-TTGames@users.noreply.github.com> Date: Tue, 28 Feb 2023 07:26:40 +0100 Subject: [PATCH 1/5] Dump option in vars --- variables.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/variables.py b/variables.py index 62a3aa0..84cb0c6 100644 --- a/variables.py +++ b/variables.py @@ -55,6 +55,11 @@ def update(self) -> None: json.dump(self._config,config_f,indent=4) config_f.truncate() + def dump(self) -> None: + '''Wipes everything but guild id from config''' + self._config = {'guild_id': self._config['guild_id']} + self.update() + @property def guild(self) -> discord.Guild: '''Returns the guild object''' From a02ee5b0a9d1e33e5d74d502808617e500960c22 Mon Sep 17 00:00:00 2001 From: "Tech. TTGames" <50541739+Tech-TTGames@users.noreply.github.com> Date: Tue, 28 Feb 2023 07:40:19 +0100 Subject: [PATCH 2/5] Dump command --- override.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/override.py b/override.py index 0b41740..bfc3de6 100644 --- a/override.py +++ b/override.py @@ -95,6 +95,16 @@ async def config(self, ctx: discord.Interaction): await ctx.followup.send("Sent config.") logging.info("Config sent.") + @app_commands.config(name="dumpconfig", description="Deletes all data from config") + @app_commands.checks(is_owner) + async def dump_config(self, ctx: discord.Interaction, confirm: bool): + """Dump config of bot""" + if confirm: + self._config.dump() + await ctx.response.send_message("Configuration dumped.\n**Prepare for unforeseen consequences.**) + return + await ctx.response.send_message("Dump aborted.") + async def setup(bot: commands.Bot): """Setup function for the cog.""" await bot.add_cog(Overrides(bot, Config(bot))) From 0daf1c48584c95b59b00877c480a5820a7445307 Mon Sep 17 00:00:00 2001 From: "Tech. TTGames" <50541739+Tech-TTGames@users.noreply.github.com> Date: Tue, 28 Feb 2023 07:40:33 +0100 Subject: [PATCH 3/5] Update variables.py --- variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.py b/variables.py index 84cb0c6..78ae984 100644 --- a/variables.py +++ b/variables.py @@ -12,7 +12,7 @@ from discord.ext import commands #v[major].[minor].[release].[build] -VERSION = "v0.0.2.4a" +VERSION = "v0.0.2.4b" PROG_DIR = os.path.dirname(os.path.realpath(__file__)) intents = discord.Intents.default() From 61bd57b3262a844953e04c51bb6e1e1b30e584b5 Mon Sep 17 00:00:00 2001 From: "Tech. TTGames" <50541739+Tech-TTGames@users.noreply.github.com> Date: Tue, 28 Feb 2023 07:42:52 +0100 Subject: [PATCH 4/5] typo --- override.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/override.py b/override.py index bfc3de6..77a171c 100644 --- a/override.py +++ b/override.py @@ -101,7 +101,7 @@ async def dump_config(self, ctx: discord.Interaction, confirm: bool): """Dump config of bot""" if confirm: self._config.dump() - await ctx.response.send_message("Configuration dumped.\n**Prepare for unforeseen consequences.**) + await ctx.response.send_message("Configuration dumped.\n**Prepare for unforeseen consequences.**") return await ctx.response.send_message("Dump aborted.") From dd25d46a9f31209391821ab0fd34b1020990c6e5 Mon Sep 17 00:00:00 2001 From: "Tech. TTGames" <50541739+Tech-TTGames@users.noreply.github.com> Date: Tue, 28 Feb 2023 07:46:14 +0100 Subject: [PATCH 5/5] var. typos --- override.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/override.py b/override.py index 77a171c..5cc3847 100644 --- a/override.py +++ b/override.py @@ -95,8 +95,8 @@ async def config(self, ctx: discord.Interaction): await ctx.followup.send("Sent config.") logging.info("Config sent.") - @app_commands.config(name="dumpconfig", description="Deletes all data from config") - @app_commands.checks(is_owner) + @app_commands.command(name="dumpconfig", description="Deletes all data from config") + @app_commands.check(is_owner) async def dump_config(self, ctx: discord.Interaction, confirm: bool): """Dump config of bot""" if confirm: