Skip to content

Commit

Permalink
Merge pull request #175 from locriandev/no-friendly-channels
Browse files Browse the repository at this point in the history
Remove friendly channels
  • Loading branch information
locriandev authored Mar 15, 2024
2 parents 9d2a03e + 3392733 commit b94c5ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
22 changes: 2 additions & 20 deletions art-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"]
Expand Down
14 changes: 0 additions & 14 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b94c5ca

Please sign in to comment.