Compare commits
No commits in common. "7ecf14be461bf0c63825ad0d2cdc9fa3834ff0a1" and "448fd2a7fdeecbcd60a2870de243f554c2ea01f4" have entirely different histories.
7ecf14be46
...
448fd2a7fd
1 changed files with 2 additions and 38 deletions
|
@ -273,20 +273,6 @@ 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)
|
||||||
|
@ -304,20 +290,6 @@ 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)
|
||||||
|
@ -334,20 +306,12 @@ class Notifications(Cog):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
log.debug(f"Removing keyword: {keyword} of {ctx.author} (ctx.author.id) on {ctx.guild} ({ctx.guild.id})")
|
log.debug(f"Removing keyword: {keyword} of {ctx.author} (ctx.author.id) on {ctx.guild} ({ctx.guild.id})")
|
||||||
cursor = await ctx.bot.db.execute(
|
await ctx.bot.db.execute(
|
||||||
"DELETE FROM keywords WHERE guild_id=? AND keyword=? AND user_id=?",
|
"DELETE FROM keywords WHERE guild_id=? AND keyword=? AND user_id=?",
|
||||||
(ctx.guild.id, keyword, ctx.author.id),
|
(ctx.guild.id, keyword, ctx.author.id),
|
||||||
)
|
)
|
||||||
await ctx.bot.db.commit()
|
await ctx.bot.db.commit()
|
||||||
if cursor.rowcount:
|
await ctx.send(f"Removed `{keyword}` from your list of keywords")
|
||||||
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()
|
@keyword.command()
|
||||||
@guild_only()
|
@guild_only()
|
||||||
|
|
Loading…
Add table
Reference in a new issue