修改细节

This commit is contained in:
shenjack 2024-02-21 23:07:21 +08:00
parent 8c87cad42f
commit 9ce466f000
Signed by: shenjack
GPG Key ID: 7B1134A979775551
4 changed files with 13 additions and 6 deletions

View File

@ -33,13 +33,14 @@ class IcaStatus:
... ...
class NewMessage:
...
class ReplyMessage: class ReplyMessage:
... ...
class SendMessage: class SendMessage:
... ...
class NewMessage:
def reply_with(self, message: str) -> SendMessage:
...

View File

@ -40,7 +40,7 @@ pub async fn add_message(payload: Payload, client: Client) {
// 就在这里处理掉最基本的消息 // 就在这里处理掉最基本的消息
// 之后的处理交给插件 // 之后的处理交给插件
if message.content.eq("/bot-rs") { if message.content.eq("/bot-rs") {
let reply = message.reply_with(&format!("ica-rs pong v{}", VERSION)); let reply = message.reply_with(&format!("ica-async-rs pong v{}", VERSION));
send_message(client, reply).await; send_message(client, reply).await;
} }
} }

View File

@ -90,5 +90,4 @@ async fn main() {
socket.disconnect().await.expect("Disconnect failed"); socket.disconnect().await.expect("Disconnect failed");
info!("Disconnected"); info!("Disconnected");
} }

View File

@ -112,6 +112,13 @@ pub struct NewMessagePy {
pub msg: NewMessage, pub msg: NewMessage,
} }
#[pymethods]
impl NewMessagePy {
pub fn reply_with(&self, content: String) -> SendMessagePy {
SendMessagePy::new(self.msg.reply_with(&content))
}
}
impl NewMessagePy { impl NewMessagePy {
pub fn new(msg: &NewMessage) -> Self { pub fn new(msg: &NewMessage) -> Self {
Self { msg: msg.clone() } Self { msg: msg.clone() }