add sanity check for smart punctuation

This commit is contained in:
Infinidoge 2025-04-13 18:45:31 -04:00
parent 7ecf14be46
commit ad8f9ea77a
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A

View file

@ -287,6 +287,18 @@ class Notifications(Cog):
elif not to_clear:
return await ctx.send("Canceled", delete_after=10)
if any(c in keyword for c in ["", "", "", ""]):
to_clear = await confirm(
ctx,
"Are you sure you want to add a keyword containing smart punctuation (aka fancy quotes)? (Reply with yes/no)\n**Note:** Smart punctuation **will frequently prevent keywords from working**.\nIf you are on an Apple device, go to your keyboard settings and disable 'Smart Punctuation'.",
True,
)
if to_clear is None:
return await ctx.send("Timed out or received an invalid response", delete_after=10)
elif not to_clear:
return await ctx.send("Canceled", delete_after=10)
await self.add_keyword(ctx.guild.id, ctx.author.id, keyword, False)
except KeywordError as e:
await e.send(ctx)