呐呐呐

This commit is contained in:
shenjack 2025-01-10 22:37:48 +08:00
parent 3ed1c3e738
commit 0275863cfe
Signed by: shenjack
GPG Key ID: 7B1134A979775551
3 changed files with 21 additions and 8 deletions

View File

@ -2,7 +2,7 @@ use crate::data_struct::ica::messages::{At, LastMessage};
use crate::data_struct::ica::RoomId;
use serde::{Deserialize, Serialize};
use serde_json::{Number, Value as JsonValue};
use serde_json::Value as JsonValue;
/// export default interface Room {
/// roomId: number
@ -39,14 +39,16 @@ pub struct Room {
impl Room {
pub fn new_from_json(raw_json: &JsonValue) -> Self {
let mut parse_json = raw_json.clone();
let parse_json = raw_json.clone();
// 手动 patch 一下 roomId
// ica issue: https://github.com/Icalingua-plus-plus/Icalingua-plus-plus/issues/793
if parse_json.get("roomId").is_none_or(|id| id.is_null()) {
use tracing::warn;
warn!("Room::new_from_json roomId is None, patching it to -1, raw: {:#?}", raw_json);
parse_json["roomId"] = JsonValue::Number(Number::from(-1));
}
// if parse_json.get("roomId").is_none_or(|id| id.is_null()) {
// use tracing::warn;
// warn!("Room::new_from_json roomId is None, patching it to -1, raw: {:#?}", raw_json);
// parse_json["roomId"] = JsonValue::Number(Number::from(-1));
// }
// 现在 fix 了
let inner = match serde_json::from_value::<InnerRoom>(parse_json) {
Ok(data) => data,
Err(e) => {

View File

@ -129,7 +129,7 @@ pub async fn send_room_sign_in(client: &Client, room_id: RoomId) -> bool {
/// 向某个群/私聊的某个人发送戳一戳
pub async fn send_poke(client: &Client, room_id: RoomId, target: UserId) -> bool {
let data = json!([room_id, target]);
let data = vec![json!(room_id), json!(target)];
match client.emit("sendGroupPoke", data).await {
Ok(_) => {
event!(Level::INFO, "已向 {} 的 {} 发送戳一戳", room_id, target);

11
news.md
View File

@ -1,5 +1,16 @@
# 更新日志
## 0.8.1
- `ica-typing` 加入了 `from __future__ import annotations`
- 这样就可以随便用 typing 了
- 把 NewType 都扬了
### ica 1.6.6
- 修复了 `send_poke` api 的问题
- 现在可以正常使用了
## 0.8.0
- ica 兼容版本号更新到 ~~`2.12.24`~~ `2.12.26`