confirm when user adds keyword with quotes
This commit is contained in:
parent
448fd2a7fd
commit
0b117ab6aa
1 changed files with 28 additions and 0 deletions
|
@ -273,6 +273,20 @@ class Notifications(Cog):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if keyword.startswith('"') and keyword.endswith('"') or keyword.startswith("“") and keyword.endswith("”"):
|
||||||
|
log.debug("Keyword surrounded with quotes")
|
||||||
|
|
||||||
|
to_clear = await confirm(
|
||||||
|
ctx,
|
||||||
|
"Are you sure you want to add a keyword surrounded with quotes? (Reply with yes/no)\n**Note:** Quotes are **not** necessary for a keyword with spaces!",
|
||||||
|
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)
|
await self.add_keyword(ctx.guild.id, ctx.author.id, keyword, False)
|
||||||
except KeywordError as e:
|
except KeywordError as e:
|
||||||
await e.send(ctx)
|
await e.send(ctx)
|
||||||
|
@ -290,6 +304,20 @@ class Notifications(Cog):
|
||||||
|
|
||||||
# TODO: Add regex names to make notifications cleaner
|
# TODO: Add regex names to make notifications cleaner
|
||||||
try:
|
try:
|
||||||
|
if keyword.startswith('"') and keyword.endswith('"') or keyword.startswith("“") and keyword.endswith("”"):
|
||||||
|
log.debug("Keyword surrounded with quotes")
|
||||||
|
|
||||||
|
to_clear = await confirm(
|
||||||
|
ctx,
|
||||||
|
"Are you sure you want to add a keyword surrounded with quotes? (Reply with yes/no)\n**Note:** Quotes are **not** necessary for a keyword with spaces!",
|
||||||
|
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, True)
|
await self.add_keyword(ctx.guild.id, ctx.author.id, keyword, True)
|
||||||
except KeywordError as e:
|
except KeywordError as e:
|
||||||
await e.send(ctx)
|
await e.send(ctx)
|
||||||
|
|
Loading…
Add table
Reference in a new issue