添加 撤回消息 的事件 以及 忽略 closeLoading 事件

This commit is contained in:
shenjack 2024-02-20 15:01:47 +08:00
parent e6df56b04d
commit 492800fed6
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 15 additions and 0 deletions

View File

@ -30,6 +30,18 @@ pub fn add_message(payload: Payload, _client: RawClient) {
} }
} }
/// 撤回消息
pub fn delete_message(payload: Payload, _client: RawClient) {
if let Payload::Text(values) = payload {
// 消息 id
if let Some(value) = values.first() {
if let Some(msg_id) = value.as_str() {
warn!("delete_message {}", format!("{}", msg_id).yellow());
}
}
}
}
pub fn any_event(event: Event, payload: Payload, _client: RawClient) { pub fn any_event(event: Event, payload: Payload, _client: RawClient) {
let handled = vec![ let handled = vec![
// 真正处理过的 // 真正处理过的
@ -39,9 +51,11 @@ pub fn any_event(event: Event, payload: Payload, _client: RawClient) {
"requireAuth", "requireAuth",
"onlineData", "onlineData",
"addMessage", "addMessage",
"deleteMessage",
// "setAllRooms", // "setAllRooms",
// 忽略的 // 忽略的
"notify", "notify",
"closeLoading", // 发送消息/加载新聊天 有一个 loading
"updateRoom", "updateRoom",
]; ];
match &event { match &event {

View File

@ -36,6 +36,7 @@ fn main() {
.on("authFailed", events::connect_callback) .on("authFailed", events::connect_callback)
.on("onlineData", events::get_online_data) .on("onlineData", events::get_online_data)
.on("addMessage", events::add_message) .on("addMessage", events::add_message)
.on("deleteMessage", events::delete_message)
.connect() .connect()
.expect("Connection failed"); .expect("Connection failed");