Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/dispatch/plugins/dispatch_slack/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,16 @@ def restricted_command_middleware(

# filter out member join bot events as the built in slack-bolt doesn't catch these events
# https://github.com/slackapi/bolt-python/blob/main/slack_bolt/middleware/ignoring_self_events/ignoring_self_events.py#L37
def is_bot(request: BoltRequest):
def is_bot(request: BoltRequest) -> bool:
body = request.body
user = body.get("event", {}).get("user")
if user == "USLACKBOT":
return True

auth_result = request.context.authorize_result
user_id = request.context.user_id
bot_id = request.body.get("event", {}).get("bot_id")
body = request.body
bot_id = body.get("event", {}).get("bot_id")

return (
auth_result is not None
and ( # noqa
Expand Down