Description
When using QQ Official Webhook adapter with unified_webhook_mode: true, all incoming webhook callbacks crash with AttributeError: 'DashboardRequest' object has no attribute 'get_data'.
The unified webhook entry (dashboard/services/platform_service.py) passes a DashboardRequest instance to QQOfficialWebhookPlatformAdapter.webhook_callback(), which then delegates to QQOfficialWebhook.handle_callback(). However, handle_callback() unconditionally calls await request.get_data(), which is a Flask Request API. DashboardRequest (and Starlette Request) does not have this method.
Traceback
File "/AstrBot/astrbot/dashboard/services/platform_service.py", line 50, in handle_webhook_callback
return await platform_adapter.webhook_callback(request_obj)
File "/AstrBot/astrbot/core/platform/sources/qqofficial_webhook/qo_webhook_adapter.py", line 215, in webhook_callback
return await self.webhook_helper.handle_callback(request)
File "/AstrBot/astrbot/core/platform/sources/qqofficial_webhook/qo_webhook_server.py", line 178, in handle_callback
body = await request.get_data()
AttributeError: 'DashboardRequest' object has no attribute 'get_data'
Affected File
astrbot/core/platform/sources/qqofficial_webhook/qo_webhook_server.py
Root Cause
DashboardRequest wraps a Starlette Request. It exposes:
request.headers
request.json (property)
request.body() — but only via the internal _request (Starlette Request)
There is no .get_data() (Flask) nor .body() (Starlette/FastAPI) directly on DashboardRequest.
Suggested Fix
In qo_webhook_server.py, line 178, change:
body = await request.get_data()
To:
if hasattr(request, "body"):
body = await request.body()
elif hasattr(request, "get_data"):
body = await request.get_data()
else:
body = await request._request.body()
This covers all three cases:
- Starlette/FastAPI
Request → await request.body()
- Flask
Request → await request.get_data()
DashboardRequest → falls back to await request._request.body()
Environment
- AstrBot version: latest (as of 2026-07-15)
- Adapter:
qq_official_webhook
unified_webhook_mode: true in platform config
Checklist
Description
When using QQ Official Webhook adapter with
unified_webhook_mode: true, all incoming webhook callbacks crash withAttributeError: 'DashboardRequest' object has no attribute 'get_data'.The unified webhook entry (
dashboard/services/platform_service.py) passes aDashboardRequestinstance toQQOfficialWebhookPlatformAdapter.webhook_callback(), which then delegates toQQOfficialWebhook.handle_callback(). However,handle_callback()unconditionally callsawait request.get_data(), which is a Flask Request API.DashboardRequest(and StarletteRequest) does not have this method.Traceback
Affected File
astrbot/core/platform/sources/qqofficial_webhook/qo_webhook_server.pyRoot Cause
DashboardRequestwraps a StarletteRequest. It exposes:request.headersrequest.json(property)request.body()— but only via the internal_request(Starlette Request)There is no
.get_data()(Flask) nor.body()(Starlette/FastAPI) directly onDashboardRequest.Suggested Fix
In
qo_webhook_server.py, line 178, change:To:
This covers all three cases:
Request→await request.body()Request→await request.get_data()DashboardRequest→ falls back toawait request._request.body()Environment
qq_official_webhookunified_webhook_mode: truein platform configChecklist