File tree Expand file tree Collapse file tree
astrbot/core/platform/sources/weixin_oc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -593,10 +593,10 @@ async def _prepare_media_item(
593593 len (str (payload .get ("upload_param" , "" ))),
594594 )
595595 upload_param = str (payload .get ("upload_param" , "" )).strip ()
596- if not upload_param :
597- raise RuntimeError ("getuploadurl returned empty upload_param" )
596+ upload_full_url = str (payload .get ("upload_full_url" , "" )).strip ()
598597
599598 encrypted_query_param = await self .client .upload_to_cdn (
599+ upload_full_url ,
600600 upload_param ,
601601 file_key ,
602602 aes_key_hex ,
Original file line number Diff line number Diff line change @@ -108,11 +108,21 @@ def parse_media_aes_key(aes_key_value: str) -> bytes:
108108
109109 async def upload_to_cdn (
110110 self ,
111+ upload_full_url : str ,
111112 upload_param : str ,
112113 file_key : str ,
113114 aes_key_hex : str ,
114115 media_path : Path ,
115116 ) -> str :
117+ if upload_full_url :
118+ cdn_url = upload_full_url
119+ elif upload_param :
120+ cdn_url = self ._build_cdn_upload_url (upload_param , file_key )
121+ else :
122+ raise ValueError (
123+ "CDN upload URL missing (need upload_full_url or upload_param)"
124+ )
125+
116126 raw_data = media_path .read_bytes ()
117127 logger .debug (
118128 "weixin_oc(%s): prepare CDN upload file=%s size=%s md5=%s filekey=%s" ,
@@ -135,7 +145,6 @@ async def upload_to_cdn(
135145 await self .ensure_http_session ()
136146 assert self ._http_session is not None
137147 timeout = aiohttp .ClientTimeout (total = self .api_timeout_ms / 1000 )
138- cdn_url = self ._build_cdn_upload_url (upload_param , file_key )
139148
140149 async with self ._http_session .post (
141150 cdn_url ,
Original file line number Diff line number Diff line change 55AstrBot 支持通过 ` 个人微信 ` 适配器接入微信个人号。该适配器基于** 腾讯微信官方** ` openclaw-weixin ` 接口实现,使用扫码登录和长轮询收发消息,不需要配置 Webhook 回调地址。
66
77> [ !NOTE]
8- > 需要升级到最新的手机微信版本:>= 8.0.70
8+ > 需要升级到最新的手机微信版本:iOS >= 8.0.70,Android >= 8.0.69,并确保微信中包含 ClawBot 插件
99
1010## 支持的消息类型
1111
You can’t perform that action at this time.
0 commit comments