diff --git a/override.py b/override.py index 0b41740..5cc3847 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.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: + 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))) diff --git a/variables.py b/variables.py index 62a3aa0..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() @@ -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'''