From 339273330c38343d7213bcb8be4c4f54077c7a3f Mon Sep 17 00:00:00 2001 From: "D. Paolella" Date: Fri, 15 Mar 2024 15:41:58 +0100 Subject: [PATCH] Remove friendly channels --- art-bot.py | 22 ++-------------------- settings.yaml | 14 -------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/art-bot.py b/art-bot.py index ff28752..780d41d 100644 --- a/art-bot.py +++ b/art-bot.py @@ -70,14 +70,6 @@ def handle_message(client, event): raise Exception(f"Invalid monitoring channel configured: {bot_config['monitoring_channel']}") bot_config["monitoring_channel_id"] = found["id"] - bot_config.setdefault("friendly_channels", []) - bot_config["friendly_channel_ids"] = [] - for channel in bot_config["friendly_channels"]: - found = lookup_channel(web_client, channel) - if not found: - raise Exception(f"Invalid friendly channel configured: {channel}") - bot_config["friendly_channel_ids"].append(found["id"]) - bot_config.setdefault("username", bot_config["self"]["name"]) except Exception as exc: @@ -106,18 +98,8 @@ def respond(client, event): # things like snippets may look like they are from normal users; if it is from us, ignore it. return - if from_channel in bot_config["friendly_channel_ids"] or data.get('bot_id'): - # in these channels we allow the bot to respond directly instead of DM'ing user back, or it was invoked by another bot - target_channel_id = from_channel - else: - # we don't support respond directly in the channel - response = web_client.conversations_open(users=user_id) - direct_message_channel_id = response["channel"]["id"] - target_channel_id = direct_message_channel_id - # If we're changing channels, we cannot target the initial message to create a thread - if target_channel_id != from_channel: - thread_ts = None - + # Always allow the bot to respond directly instead of DM'ing user back, or it was invoked by another bot + target_channel_id = from_channel alt_username = None if bot_config["self"]["name"] != bot_config["username"]: alt_username = bot_config["username"] diff --git a/settings.yaml b/settings.yaml index ebbb6dc..f3f2e1e 100644 --- a/settings.yaml +++ b/settings.yaml @@ -4,20 +4,6 @@ # channel where bot reports what is being asked and any errors monitoring_channel: art-bot-monitoring -# channels the bot can respond in instead of DM'ing user back -friendly_channels: -- team-art -- forum-ocp-art -- forum-ocp-release -- art-release -- art-release-3-11 -- art-release-4-7 -- art-release-4-8 -- art-release-4-9 -- art-release-4-10 -- art-release-4-11 -- art-release-4-12 -- art-release-4-13 # files are relative to $HOME if not absolute. # you'll need to look these up in vault and create the files locally.