mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-10 15:56:03 +00:00
feat: complete eba adapter acceptance path
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user