correctly reply whether keyword was removed

This commit is contained in:
Infinidoge 2025-03-27 12:46:40 -04:00
parent 0b117ab6aa
commit 7ecf14be46
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A

View file

@ -334,12 +334,20 @@ class Notifications(Cog):
"""
log.debug(f"Removing keyword: {keyword} of {ctx.author} (ctx.author.id) on {ctx.guild} ({ctx.guild.id})")
await ctx.bot.db.execute(
cursor = await ctx.bot.db.execute(
"DELETE FROM keywords WHERE guild_id=? AND keyword=? AND user_id=?",
(ctx.guild.id, keyword, ctx.author.id),
)
await ctx.bot.db.commit()
await ctx.send(f"Removed `{keyword}` from your list of keywords")
if cursor.rowcount:
log.debug("Removed keyword")
await ctx.send(f"Removed `{keyword}` from your list of keywords")
else:
log.debug("Keyword not found")
await ctx.send(
f"Keyword `{keyword}` not found.\n**Note:** Removing keywords is case-sensitive, double check that the keyword is exactly as listed in `{await ctx.bot.get_guild_prefix(ctx.guild)
}keyword list`"
)
@keyword.command()
@guild_only()