middleware.py 的导入方式、senderID 来源、同步错误处理和常见返回体。
导入方式
getSenderID() 从运行时参数读取当前运行上下文 ID。消息触发、路由触发、cron / fake 上下文都会由 autClaw 注入运行时凭据;插件不要自行拼接 /api/plugins/runtime 地址。
常用返回值
SendReceipt
文本、媒体和撤回类方法通常返回发送回执。receipt.get("ok") is False,消息 ID 同时兼容 message_id 和 messageid。
FileDownloadResult
fileDownload(...) 和 downloadAdapterFile(...) 返回本地文件信息。
MediaItem
sender.getMediaItems() 返回当前事件或最近一次 listen(...) / input(...) 捕获到的媒体项。
downloadAdapterFile(...),不要手动解析平台原始字段。
WaitPaySuccess
waitPay(...) 支付成功时返回支付事件对象;超时返回字符串 "timeout",繁忙返回 "busy"。
错误处理
Python SDK 同步返回数据。运行时请求失败、必填参数为空或依赖安装失败时会抛出Exception。
下一步
- 读取用户、会话和回复消息:
Sender 消息能力 - 查看完整签名:
Python 签名速查