From 49a7ac9fd7f19f0578ea3fe0dd3fe3f556fd854a Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Sat, 28 Dec 2024 04:05:26 -0500 Subject: [PATCH] implement pause toggle --- nomen/notifications.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nomen/notifications.py b/nomen/notifications.py index 32ecc12..48e5de1 100644 --- a/nomen/notifications.py +++ b/nomen/notifications.py @@ -303,8 +303,14 @@ class Notifications(Cog): @keyword.command() @guild_only() async def pause(self, ctx): - pass - # TODO: Pause guild notifications + params = (ctx.author.id, ctx.guild_id) + if await fetch_exists("SELECT * FROM user_pauses WHERE user_id=? AND guild_id=?"): + await ctx.bot.db.execute("DELETE FROM user_pauses WHERE user_id=? AND guild_id=?", params) + await ctx.bot.send(f"Resumed notifications in {ctx.guild}") + else: + await ctx.bot.db.execute("INSERT INTO user_pauses VALUES(?, ?)", params) + await ctx.bot.send(f"Paused notifications in {ctx.guild}") + # TODO: Pause guild notifications in handler @keyword.group(invoke_without_command=True) @guild_only()