Skip to content

Commit

Permalink
Adds additional bot check. (#4884)
Browse files Browse the repository at this point in the history
* Adds additional bot check.

* Fixes placement of users_info API call

* Update src/dispatch/plugins/dispatch_slack/middleware.py

Co-authored-by: Jason Schroth <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/middleware.py

Co-authored-by: Jason Schroth <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/middleware.py

Co-authored-by: Jason Schroth <[email protected]>

---------

Co-authored-by: Jason Schroth <[email protected]>
  • Loading branch information
metroid-samus and jschroth authored Jun 26, 2024
1 parent 221f28f commit 6374d53
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dispatch/plugins/dispatch_slack/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ def user_middleware(
user_in=UserRegister(email=participant.individual.email),
)
else:
email = client.users_info(user=user_id)["user"]["profile"]["email"]
user_info = client.users_info(user=user_id).get("user", {})

if user_info.get("is_bot", False):
return context.ack()

email = user_info.get("profile", {}).get("email")

if not email:
raise ContextError("Unable to get user email address.")
Expand Down

0 comments on commit 6374d53

Please sign in to comment.