This commit is contained in:
shenjack 2024-06-15 02:46:46 +08:00
parent d9c17ea064
commit 1e81db998f
Signed by: shenjack
GPG Key ID: 7B1134A979775551
5 changed files with 13 additions and 5 deletions

View File

@ -188,9 +188,9 @@ class TailchatReciveMessage:
@property
def sender_id(self) -> TailchatType.UserId:
...
# @property
# def is_from_self(self) -> bool:
# ...
@property
def is_from_self(self) -> bool:
...
@property
def is_reply(self) -> bool:
...

View File

@ -47,6 +47,10 @@ impl ReceiveMessage {
}
}
pub fn is_from_self(&self) -> bool {
crate::MainStatus::global_tailchat_status().user_id == self.sender_id
}
/// 创建一个对这条消息的回复
pub fn as_reply(&self) -> SendingMessage {
SendingMessage::new(

View File

@ -80,6 +80,8 @@ impl TailchatReceiveMessagePy {
#[getter]
pub fn get_is_reply(&self) -> bool { self.message.is_reply() }
#[getter]
pub fn get_is_from_self(&self) -> bool { self.message.is_from_self() }
#[getter]
pub fn get_msg_id(&self) -> MessageId { self.message.msg_id.clone() }
#[getter]
pub fn get_content(&self) -> String { self.message.content.clone() }

View File

@ -104,8 +104,8 @@ pub async fn on_converse_update(payload: Payload, client: Client) {
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());
event!(Level::WARN, "tailchat updateDMConverse {}", value.to_string().red());
event!(Level::WARN, "tailchat updateDMConverse {}", format!("{:?}", e).red());
return;
}
};

View File

@ -14,6 +14,8 @@
- 因为现在他俩已经进到 `rust_socketio` 里啦
- 添加了新的 macro
- ``
- 支持了 `TailchatReceiveMessagePy``is_from_self` 方法
- 用于判断是否是自己发的消息
## 0.6.7