From 2737d3d16b1f5a60864a60deaf18f353c9816934 Mon Sep 17 00:00:00 2001 From: MarkusRost <2701034-MarkusRost@users.noreply.gitlab.com> Date: Fri, 25 Oct 2024 01:05:10 +0000 Subject: [PATCH] add block button with disabled talk page --- extensions/hooks/buttons.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/extensions/hooks/buttons.py b/extensions/hooks/buttons.py index 1a293d0..3c17eb8 100644 --- a/extensions/hooks/buttons.py +++ b/extensions/hooks/buttons.py @@ -25,6 +25,7 @@ from src.configloader import settings # "hooks": { # "buttons": { # "block": "Block user", +# "blocknotalk": "Block user (disable talk)", # "delete": "Delete", # "filerevert": "Revert", # "move": "Move back", @@ -53,10 +54,15 @@ def buttons_hook(message: DiscordMessage, metadata: DiscordMessageMetadata, cont if not len(action_buttons) or context.feed_type == "discussion": return BUTTON_PREFIX = context.client.WIKI_SCRIPT_PATH[len(context.client.WIKI_JUST_DOMAIN):] - if "block" in action_buttons and context.event != "suppressed": - add_button(message, - BUTTON_PREFIX + " block " + ("#" + str(change["userid"]) if change["userid"] else change["user"]), - action_buttons["block"], 4, {"id": None, "name": "🚧"}) + if context.event != "suppressed": + if "blocknotalk" in action_buttons: + add_button(message, + BUTTON_PREFIX + " blocknotalk " + ("#" + str(change["userid"]) if change["userid"] else change["user"]), + action_buttons["blocknotalk"], 4, {"id": None, "name": "🚧"}) + if "block" in action_buttons: + add_button(message, + BUTTON_PREFIX + " block " + ("#" + str(change["userid"]) if change["userid"] else change["user"]), + action_buttons["block"], 4, {"id": None, "name": "🚧"}) if context.feed_type != "recentchanges": return if "delete" in action_buttons and context.event in ("new", "upload/upload"):