feat: complete eba adapter acceptance path

This commit is contained in:
Junyan Qin
2026-05-10 18:58:18 +08:00
parent 63bdee22b4
commit 3ed35593e9
10 changed files with 305 additions and 164 deletions

View File

@@ -101,7 +101,15 @@ class AiocqhttpMessageConverter(abstract_platform_adapter.AbstractMessageConvert
target.append(aiocqhttp.MessageSegment.record(file_arg))
elif isinstance(component, platform_message.File):
file_arg = component.url or component.path or component.base64 or component.id
target.append({'type': 'file', 'data': {'file': file_arg, 'name': component.name or 'file'}})
target.append(
aiocqhttp.MessageSegment(
type_='file',
data={
'file': file_arg,
'name': component.name or 'file',
},
)
)
elif isinstance(component, platform_message.Face):
if component.face_type == 'rps':
target.append(aiocqhttp.MessageSegment.rps())

View File

@@ -27,7 +27,10 @@ class TelegramMessageConverter(abstract_platform_adapter.AbstractMessageConverte
photo_bytes = None
if component.base64:
photo_bytes = base64.b64decode(component.base64)
b64_data = component.base64
if ';base64,' in b64_data:
b64_data = b64_data.split(';base64,', 1)[1]
photo_bytes = base64.b64decode(b64_data)
elif component.url:
session = httpclient.get_session()
async with session.get(component.url) as response:

View File

@@ -396,6 +396,7 @@ class RuntimeBot:
event: platform_events.EBAEvent,
adapter: abstract_platform_adapter.AbstractMessagePlatformAdapter,
):
event.bot_uuid = self.bot_entity.uuid
plugin_event = self._eba_event_to_plugin_event(event)
if plugin_event is None:
return