add additional debug logs for adding keywords
This commit is contained in:
parent
57bf820501
commit
ec54e31b5c
1 changed files with 5 additions and 0 deletions
|
@ -152,12 +152,14 @@ class Notifications(Cog):
|
|||
"""
|
||||
|
||||
if test_keyword(keyword, regex):
|
||||
log.debug("Keyword too common")
|
||||
await ctx.send(f"{'Regex' if regex else 'Keyword'} matches a word that is too common")
|
||||
return
|
||||
|
||||
conflicts = await fetch_unpacked(ctx.bot.db, existing, params)
|
||||
|
||||
if conflicts:
|
||||
log.debug("Keyword conflicts with existing keyword")
|
||||
await ctx.send(f"Any instance of `{keyword}` would be matched by existing keywords (check DMs)")
|
||||
await ctx.author.send(
|
||||
f"Conflicts with keyword `{keyword}`:\n" + "\n".join(f"- `{conflict}`" for conflict in conflicts)
|
||||
|
@ -167,12 +169,15 @@ class Notifications(Cog):
|
|||
conflicts = await fetch_unpacked(ctx.bot.db, redundant, params)
|
||||
|
||||
if conflicts:
|
||||
log.debug("Keyword renders existing redundant")
|
||||
await ctx.send(f"Adding `{keyword}` will cause existing keywords to never match (check DMs)")
|
||||
await ctx.author.send(
|
||||
f"Keywords redundant from `{keyword}`:\n" + "\n".join(f" - `{conflict}`" for conflict in conflicts)
|
||||
)
|
||||
return
|
||||
|
||||
log.debug("Keyword valid, adding")
|
||||
|
||||
await ctx.bot.db.execute(
|
||||
"INSERT INTO keywords (guild_id, keyword, user_id, regex) VALUES (:guild_id, :keyword, :user_id, :regex)",
|
||||
params,
|
||||
|
|
Loading…
Reference in a new issue