From 4b1ed03b9af3ff9326647d47c94bb1ff1c0fe6fc Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 25 Jun 2024 23:27:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=8A=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/src/data_struct/tailchat/messages.rs | 7 +------ ica-rs/src/py/class/tailchat.rs | 12 ++++++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ica-rs/src/data_struct/tailchat/messages.rs b/ica-rs/src/data_struct/tailchat/messages.rs index 5bc7af6..36b9d0e 100644 --- a/ica-rs/src/data_struct/tailchat/messages.rs +++ b/ica-rs/src/data_struct/tailchat/messages.rs @@ -89,12 +89,7 @@ pub enum SendingFile { None, /// 需要生成 /// [img height=1329 width=1918]{BACKEND}/static/files/6602e20d7b8d10675758e36b/8db505b87bdf9fb309467abcec4d8e2a.png[/img] - Image { - file: Vec, - name: String, - width: u32, - height: u32, - }, + Image { file: Vec, name: String }, /// [card type=file url={BACKEND}/static/files/6602e20d7b8d10675758e36b/9df28943d17b9713cb0ea9625f37d015.wav]Engine.wav[/card] File { file: Vec, name: String }, } diff --git a/ica-rs/src/py/class/tailchat.rs b/ica-rs/src/py/class/tailchat.rs index e2971a5..7e50162 100644 --- a/ica-rs/src/py/class/tailchat.rs +++ b/ica-rs/src/py/class/tailchat.rs @@ -3,7 +3,7 @@ use pyo3::prelude::*; use rust_socketio::asynchronous::Client; use tracing::{debug, info, warn}; -use crate::data_struct::tailchat::messages::{ReceiveMessage, SendingMessage}; +use crate::data_struct::tailchat::messages::{ReceiveMessage, SendingFile, SendingMessage}; use crate::data_struct::tailchat::{ConverseId, GroupId, MessageId, UserId}; use crate::tailchat::client::send_message; @@ -124,7 +124,11 @@ impl TailchatSendingMessagePy { self.message.content = content; self.clone() } - // pub fn set_img(&mut self, file: Vec, file_type: String) { - // self.message.add_img(file, file_type, as_sticker); - // } + pub fn set_img(&mut self, file: Vec, file_name: String) { + let file = SendingFile::Image { + file, + name: file_name, + }; + self.message.add_img(file); + } }