insert default settings before opting in or out

This commit is contained in:
Infinidoge 2025-05-22 17:16:12 -04:00
parent 40e6c44be0
commit a5a6312403
Signed by: Infinidoge
SSH key fingerprint: SHA256:GT2StvPQMMfFHyiiFJymQxfTG/z6EWLJ6NWItf5K5sA

View file

@ -150,6 +150,8 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
You will not trigger anyone else's notifications, and you will not receive any notifications You will not trigger anyone else's notifications, and you will not receive any notifications
""" """
await self.bot.db.execute("INSERT OR IGNORE INTO users (user_id) VALUES(?)", (ctx.author.id,))
if await ctx.bot.get_setting(ctx.author.id, "disabled"): if await ctx.bot.get_setting(ctx.author.id, "disabled"):
await ctx.send("You are already opted-out") await ctx.send("You are already opted-out")
return return
@ -160,7 +162,6 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
f"You have now opted-out and will no longer trigger or receive notifications. To opt back in, run `{ctx.clean_prefix}nomen opt-in`" f"You have now opted-out and will no longer trigger or receive notifications. To opt back in, run `{ctx.clean_prefix}nomen opt-in`"
) )
await self.bot.db.execute("INSERT OR IGNORE INTO users (user_id) VALUES(?)", (ctx.author.id,))
await self.bot.db.execute("UPDATE users SET disabled=1 WHERE user_id=?", (ctx.author.id,)) await self.bot.db.execute("UPDATE users SET disabled=1 WHERE user_id=?", (ctx.author.id,))
await self.bot.db.commit() await self.bot.db.commit()
@ -170,6 +171,8 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
Opt-in to Nomen processing your messages Opt-in to Nomen processing your messages
""" """
await self.bot.db.execute("INSERT OR IGNORE INTO users (user_id) VALUES(?)", (ctx.author.id,))
if not await ctx.bot.get_setting(ctx.author.id, "disabled"): if not await ctx.bot.get_setting(ctx.author.id, "disabled"):
await ctx.send("You are already opted-in") await ctx.send("You are already opted-in")
return return
@ -180,7 +183,6 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
f"You have opted back in and will now trigger and receive notifications. To opt out, run `{ctx.clean_prefix}nomen opt-out`" f"You have opted back in and will now trigger and receive notifications. To opt out, run `{ctx.clean_prefix}nomen opt-out`"
) )
await self.bot.db.execute("INSERT OR IGNORE INTO users (user_id) VALUES(?)", (ctx.author.id,))
await self.bot.db.execute("UPDATE users SET disabled=0 WHERE user_id=?", (ctx.author.id,)) await self.bot.db.execute("UPDATE users SET disabled=0 WHERE user_id=?", (ctx.author.id,))
await self.bot.db.commit() await self.bot.db.commit()