mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 12:41:05 +08:00
优化代码结构和性能
This commit is contained in:
parent
5381ef598a
commit
29f6b2efaf
|
@ -18,7 +18,7 @@ pub enum At {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl At {
|
impl At {
|
||||||
/// new_from_json(&message["at"])
|
#[inline]
|
||||||
pub fn new_from_json(json: &JsonValue) -> Self {
|
pub fn new_from_json(json: &JsonValue) -> Self {
|
||||||
match json {
|
match json {
|
||||||
JsonValue::Bool(b) => Self::Bool(*b),
|
JsonValue::Bool(b) => Self::Bool(*b),
|
||||||
|
|
|
@ -51,7 +51,6 @@ pub async fn add_message(payload: Payload, client: Client) {
|
||||||
pub async fn set_messages(payload: Payload, _client: Client) {
|
pub async fn set_messages(payload: Payload, _client: Client) {
|
||||||
if let Payload::Text(values) = payload {
|
if let Payload::Text(values) = payload {
|
||||||
if let Some(value) = values.first() {
|
if let Some(value) = values.first() {
|
||||||
println!("{:#?}", value);
|
|
||||||
let messages: Vec<Message> = serde_json::from_value(value["messages"].clone()).unwrap();
|
let messages: Vec<Message> = serde_json::from_value(value["messages"].clone()).unwrap();
|
||||||
let room_id = value["roomId"].as_i64().unwrap();
|
let room_id = value["roomId"].as_i64().unwrap();
|
||||||
info!("set_messages {} len: {}", room_id.to_string().cyan(), messages.len());
|
info!("set_messages {} len: {}", room_id.to_string().cyan(), messages.len());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user