Compare commits

...

3 Commits

Author SHA1 Message Date
cd67c5b94d
0.6.7 2024-06-12 01:09:20 +08:00
7fbe91e55e
looks good 2024-06-10 22:08:37 +08:00
b3e9588763
避免错误信息太长,以及加点提前过滤 2024-06-10 17:33:33 +08:00
7 changed files with 23 additions and 9 deletions

2
Cargo.lock generated
View File

@ -659,7 +659,7 @@ dependencies = [
[[package]]
name = "ica-rs"
version = "0.6.6"
version = "0.6.7"
dependencies = [
"anyhow",
"base64 0.22.1",

View File

@ -1,6 +1,6 @@
[package]
name = "ica-rs"
version = "0.6.6"
version = "0.6.7"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -323,6 +323,8 @@ def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
bangbang_img(msg, client)
except: # noqa
report_msg = f"bmcl插件发生错误,请呼叫shenjack\n{traceback.format_exc()}"
if len(report_msg) > 200:
report_msg = report_msg[:200] + "..." # 防止消息过长
reply = msg.reply_with(report_msg)
client.send_and_warn(reply)
@ -364,6 +366,8 @@ def on_tailchat_message(msg, client) -> None:
bangbang_img(msg, client)
except: # noqa
report_msg = f"bmcl插件发生错误,请呼叫shenjack\n{traceback.format_exc()}"
if len(report_msg) > 200:
report_msg = report_msg[:200] + "..." # 防止消息过长
reply = msg.reply_with(report_msg)
client.send_and_warn(reply)

View File

@ -1,5 +1,4 @@
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use crate::data_struct::tailchat::UserId;

View File

@ -122,10 +122,11 @@ pub async fn any_event(event: Event, payload: Payload, _client: Client) {
"setAllChatGroups",
// 忽略的
"notify",
"syncRead", // 同步已读
"closeLoading", // 发送消息/加载新聊天 有一个 loading
"renewMessage", // 我也不确定到底是啥事件
"requestSetup", // 需要登录
"updateRoom",
"syncRead", // 同步已读
];
match &event {
Event::Custom(event_name) => {

View File

@ -25,8 +25,8 @@ pub type MainStatus = status::BotStatus;
pub type StopGetter = tokio::sync::oneshot::Receiver<()>;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const ICA_VERSION: &str = "1.5.0";
pub const TAILCHAT_VERSION: &str = "1.0.0";
pub const ICA_VERSION: &str = "1.6.0";
pub const TAILCHAT_VERSION: &str = "1.1.0";
#[macro_export]
macro_rules! wrap_callback {

View File

@ -4,7 +4,8 @@ use rust_socketio::{Event, Payload};
use tracing::info;
use crate::data_struct::tailchat::messages::ReciveMessage;
use crate::tailchat::client::send_message;
use crate::data_struct::tailchat::status::UpdateDMConverse;
use crate::tailchat::client::{emit_join_room, send_message};
/// 所有
pub async fn any_event(event: Event, payload: Payload, _client: Client) {
@ -93,10 +94,19 @@ pub async fn on_msg_delete(payload: Payload, _client: Client) {
}
}
pub async fn on_converse_update(payload: Payload, _client: Client) {
pub async fn on_converse_update(payload: Payload, client: Client) {
if let Payload::Text(values) = payload {
if let Some(value) = values.first() {
info!("更新会话 {}", value.to_string().green());
emit_join_room(&client).await;
let update_info: UpdateDMConverse = match serde_json::from_value(value.clone()) {
Ok(value) => value,
Err(e) => {
info!("tailchat updateDMConverse {}", value.to_string().red());
info!("tailchat updateDMConverse {}", format!("{:?}", e).red());
return;
}
};
info!("更新会话 {}", format!("{:?}", update_info).cyan());
}
}
}