mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 20:45:06 +08:00
修改细节
This commit is contained in:
parent
8c87cad42f
commit
9ce466f000
|
@ -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:
|
||||||
|
...
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,5 +90,4 @@ async fn main() {
|
||||||
|
|
||||||
socket.disconnect().await.expect("Disconnect failed");
|
socket.disconnect().await.expect("Disconnect failed");
|
||||||
info!("Disconnected");
|
info!("Disconnected");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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() }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user