make hooks handle suppressed

This commit is contained in:
MarkusRost 2024-10-09 16:40:54 +00:00
parent a8772ecdfb
commit 7cd72f9595
3 changed files with 6 additions and 2 deletions

View file

@ -61,7 +61,7 @@ if dbconn:
@post_hook
def db_interaction_hook(message, metadata, context, change):
# Check if user is in the database
if not dbconn:
if not dbconn or context.event == "suppressed":
return
with db_singleton.obtain_cursor() as cursor:
cursor.execute(

View file

@ -126,6 +126,10 @@ def edit_alerts_hook(message, metadata, context, change):
# If current action isn't in config for this requirement AND current event type is not in the requirements in settings skip this requirement
if req_action and context.event not in req_action and context.event.split('/', 1)[0] not in req_action:
raise RequirementNotMet
if context.event == "suppressed":
if req_action and context.event in req_action:
break
raise RequirementNotMet
req_user = requirement.get("user", [])
change_user = None
change_anon = False

View file

@ -37,7 +37,7 @@ def add_mention(message, userid):
@post_hook
def usertalk_hook(message: DiscordMessage, metadata: DiscordMessageMetadata, context: Context, change: dict):
if not discord_users:
if not discord_users or context.event == "suppressed":
return
if context.feed_type in ["recentchanges", "abuselog"] and change["ns"] in [2, 3, 202, 1200] and "/" not in change["title"]:
username = change["title"].split(':', 1)[1]