-
-
Save KyMidd/6234ea345a0ec325ece52385670446d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Main function | |
| if __name__ == "__main__": | |
| ... | |
| # Responds to app mentions | |
| @app.event("app_mention") | |
| def handle_app_mention_events(client, body, say, req, payload): | |
| # Check for duplicate event or trash messages, return 200 and exit if detected | |
| if check_for_duplicate_event(req.headers, payload): | |
| return generate_response( | |
| 200, "❌ Detected a re-send or edited message, exiting" | |
| ) | |
| # Handle request | |
| handle_message_event(client, body, say, bedrock_client, app, token) | |
| # Respond to file share events | |
| @app.event("message") | |
| def handle_message_events(client, body, say, req, payload): | |
| # Check for duplicate event or trash messages, return 200 and exit if detected | |
| if check_for_duplicate_event(req.headers, payload): | |
| return generate_response( | |
| 200, "❌ Detected a re-send or edited message, exiting" | |
| ) | |
| # Handle request | |
| handle_message_event(client, body, say, bedrock_client, app, token) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment