implement purge command

This commit is contained in:
Infinidoge 2024-12-19 01:13:59 -05:00
parent 981e113af8
commit 35b43332e4
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A

View file

@ -25,7 +25,28 @@ class Settings(Cog):
""" """
Deletes all user data stored in Nomen 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") @nomen.command(name="import")
@guild_only() @guild_only()