From 35b43332e45e4d67a57c59d3118dbb4ced6e0218 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Thu, 19 Dec 2024 01:13:59 -0500 Subject: [PATCH] implement purge command --- nomen/settings.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/nomen/settings.py b/nomen/settings.py index 137ccba..814da3e 100644 --- a/nomen/settings.py +++ b/nomen/settings.py @@ -25,7 +25,28 @@ class Settings(Cog): """ Deletes all user data stored in Nomen """ - pass + + msg = f"""\ +Are you sure you wish to delete **ALL** data across **ALL** servers? (y/N) +NOTE: If you have currently opted-out, this will opt you back in. + +You may want to `{ctx.clean_prefix}nomen export` first""" + + to_purge = await confirm(ctx, msg) + + if to_purge: + await self.bot.db.execute( + """ + DELETE FROM keywords WHERE user_id=?; + DELETE FROM users WHERE user_id=?; + DELETE FROM user_ignores WHERE user_id=?; + """, + (ctx.author.id,), + ) + await self.bot.db.commit() + await ctx.send("Deleted all user data.") + else: + await ctx.send("Cancelled.") @nomen.command(name="import") @guild_only()