diff --git a/ica-rs/ica_typing.py b/ica-rs/ica_typing.py index edf3400..078209a 100644 --- a/ica-rs/ica_typing.py +++ b/ica-rs/ica_typing.py @@ -33,13 +33,14 @@ class IcaStatus: ... -class NewMessage: - ... - - class ReplyMessage: ... class SendMessage: ... + + +class NewMessage: + def reply_with(self, message: str) -> SendMessage: + ... diff --git a/ica-rs/src/events.rs b/ica-rs/src/events.rs index c98eea5..065064d 100644 --- a/ica-rs/src/events.rs +++ b/ica-rs/src/events.rs @@ -40,7 +40,7 @@ pub async fn add_message(payload: Payload, client: Client) { // 就在这里处理掉最基本的消息 // 之后的处理交给插件 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; } } diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 1cbe7e1..2ee9c15 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -90,5 +90,4 @@ async fn main() { socket.disconnect().await.expect("Disconnect failed"); info!("Disconnected"); - } diff --git a/ica-rs/src/py/class.rs b/ica-rs/src/py/class.rs index b68f335..559acbf 100644 --- a/ica-rs/src/py/class.rs +++ b/ica-rs/src/py/class.rs @@ -112,6 +112,13 @@ pub struct NewMessagePy { pub msg: NewMessage, } +#[pymethods] +impl NewMessagePy { + pub fn reply_with(&self, content: String) -> SendMessagePy { + SendMessagePy::new(self.msg.reply_with(&content)) + } +} + impl NewMessagePy { pub fn new(msg: &NewMessage) -> Self { Self { msg: msg.clone() }