mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
make hooks handle suppressed
This commit is contained in:
parent
a8772ecdfb
commit
7cd72f9595
|
@ -61,7 +61,7 @@ if dbconn:
|
||||||
@post_hook
|
@post_hook
|
||||||
def db_interaction_hook(message, metadata, context, change):
|
def db_interaction_hook(message, metadata, context, change):
|
||||||
# Check if user is in the database
|
# Check if user is in the database
|
||||||
if not dbconn:
|
if not dbconn or context.event == "suppressed":
|
||||||
return
|
return
|
||||||
with db_singleton.obtain_cursor() as cursor:
|
with db_singleton.obtain_cursor() as cursor:
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
|
|
|
@ -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 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:
|
if req_action and context.event not in req_action and context.event.split('/', 1)[0] not in req_action:
|
||||||
raise RequirementNotMet
|
raise RequirementNotMet
|
||||||
|
if context.event == "suppressed":
|
||||||
|
if req_action and context.event in req_action:
|
||||||
|
break
|
||||||
|
raise RequirementNotMet
|
||||||
req_user = requirement.get("user", [])
|
req_user = requirement.get("user", [])
|
||||||
change_user = None
|
change_user = None
|
||||||
change_anon = False
|
change_anon = False
|
||||||
|
|
|
@ -37,7 +37,7 @@ def add_mention(message, userid):
|
||||||
|
|
||||||
@post_hook
|
@post_hook
|
||||||
def usertalk_hook(message: DiscordMessage, metadata: DiscordMessageMetadata, context: Context, change: dict):
|
def usertalk_hook(message: DiscordMessage, metadata: DiscordMessageMetadata, context: Context, change: dict):
|
||||||
if not discord_users:
|
if not discord_users or context.event == "suppressed":
|
||||||
return
|
return
|
||||||
if context.feed_type in ["recentchanges", "abuselog"] and change["ns"] in [2, 3, 202, 1200] and "/" not in change["title"]:
|
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]
|
username = change["title"].split(':', 1)[1]
|
||||||
|
|
Loading…
Reference in a new issue