Spaces:
Sleeping
Sleeping
fix5
Browse files
app.py
CHANGED
|
@@ -357,11 +357,12 @@ async def handle_mention(event, say, client):
|
|
| 357 |
# Initialize the Async Slack Request Handler
|
| 358 |
handler = AsyncSlackRequestHandler(app)
|
| 359 |
|
|
|
|
| 360 |
@api.post("/slack/events")
|
| 361 |
async def slack_events(request: Request):
|
| 362 |
"""Endpoint for all Slack event subscriptions."""
|
| 363 |
try:
|
| 364 |
-
return await handler.
|
| 365 |
except Exception as e:
|
| 366 |
logger.error(f"Error handling Slack events: {e}")
|
| 367 |
raise
|
|
@@ -402,11 +403,12 @@ async def install_url():
|
|
| 402 |
logger.error(f"Error generating install URL: {e}")
|
| 403 |
raise
|
| 404 |
|
|
|
|
| 405 |
@api.get("/slack/oauth/callback")
|
| 406 |
async def oauth_callback(request: Request):
|
| 407 |
"""Handles the OAuth callback from Slack to complete installation."""
|
| 408 |
try:
|
| 409 |
-
response = await handler.
|
| 410 |
# For successful OAuth, return a simple HTML response
|
| 411 |
if hasattr(response, 'status_code') and response.status_code == 200:
|
| 412 |
return HTMLResponse(
|
|
|
|
| 357 |
# Initialize the Async Slack Request Handler
|
| 358 |
handler = AsyncSlackRequestHandler(app)
|
| 359 |
|
| 360 |
+
# In the slack_events endpoint (around line 364)
|
| 361 |
@api.post("/slack/events")
|
| 362 |
async def slack_events(request: Request):
|
| 363 |
"""Endpoint for all Slack event subscriptions."""
|
| 364 |
try:
|
| 365 |
+
return await handler.handle(request) # Changed from handle_async
|
| 366 |
except Exception as e:
|
| 367 |
logger.error(f"Error handling Slack events: {e}")
|
| 368 |
raise
|
|
|
|
| 403 |
logger.error(f"Error generating install URL: {e}")
|
| 404 |
raise
|
| 405 |
|
| 406 |
+
# In the oauth_callback endpoint
|
| 407 |
@api.get("/slack/oauth/callback")
|
| 408 |
async def oauth_callback(request: Request):
|
| 409 |
"""Handles the OAuth callback from Slack to complete installation."""
|
| 410 |
try:
|
| 411 |
+
response = await handler.handle(request) # Changed from handle_async
|
| 412 |
# For successful OAuth, return a simple HTML response
|
| 413 |
if hasattr(response, 'status_code') and response.status_code == 200:
|
| 414 |
return HTMLResponse(
|