mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 12:41:05 +08:00
0.6.6!
This commit is contained in:
parent
3451424544
commit
79dbebdd4e
|
@ -54,9 +54,9 @@ impl ReciveMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 回复这条消息
|
/// 回复这条消息
|
||||||
pub fn reply_with(&self, content: &String) -> SendingMessage {
|
pub fn reply_with(&self, content: &str) -> SendingMessage {
|
||||||
SendingMessage::new(
|
SendingMessage::new(
|
||||||
content.clone(),
|
content.to_string(),
|
||||||
self.converse_id.clone(),
|
self.converse_id.clone(),
|
||||||
self.group_id.clone(),
|
self.group_id.clone(),
|
||||||
Some(ReplyMeta::from_recive_message(self)),
|
Some(ReplyMeta::from_recive_message(self)),
|
||||||
|
|
|
@ -77,7 +77,7 @@ pub async fn start_ica(config: &IcaConfig, stop_reciver: StopGetter) -> ClientRe
|
||||||
rust_socketio::Error::IncompleteResponseFromEngineIo(inner_e) => {
|
rust_socketio::Error::IncompleteResponseFromEngineIo(inner_e) => {
|
||||||
if inner_e.to_string().contains("AlreadyClosed") {
|
if inner_e.to_string().contains("AlreadyClosed") {
|
||||||
event!(Level::INFO, "socketio client stopped");
|
event!(Level::INFO, "socketio client stopped");
|
||||||
return Ok(());
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
event!(Level::ERROR, "socketio client stopped with error: {:?}", inner_e);
|
event!(Level::ERROR, "socketio client stopped with error: {:?}", inner_e);
|
||||||
Err(IcaError::SocketIoError(
|
Err(IcaError::SocketIoError(
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::path::PathBuf;
|
||||||
|
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use rust_socketio::asynchronous::Client;
|
use rust_socketio::asynchronous::Client;
|
||||||
use tracing::{debug, info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::data_struct::{ica, tailchat};
|
use crate::data_struct::{ica, tailchat};
|
||||||
use crate::error::PyPluginError;
|
use crate::error::PyPluginError;
|
||||||
|
@ -174,7 +174,7 @@ pub async fn tailchat_new_message_py(message: &tailchat::messages::ReciveMessage
|
||||||
|
|
||||||
let plugins = PyStatus::get_files();
|
let plugins = PyStatus::get_files();
|
||||||
for (path, plugin) in plugins.iter() {
|
for (path, plugin) in plugins.iter() {
|
||||||
let msg = class::tailchat::TailchatReciveMessagePy::from_recive_message(&message);
|
let msg = class::tailchat::TailchatReciveMessagePy::from_recive_message(message);
|
||||||
let client = class::tailchat::TailchatClientPy::new(client);
|
let client = class::tailchat::TailchatClientPy::new(client);
|
||||||
let args = (msg, client);
|
let args = (msg, client);
|
||||||
call_py_func!(args, plugin, path, TAILCHAT_NEW_MESSAGE_FUNC, client);
|
call_py_func!(args, plugin, path, TAILCHAT_NEW_MESSAGE_FUNC, client);
|
||||||
|
|
|
@ -6,7 +6,7 @@ use md5::{Digest, Md5};
|
||||||
use reqwest::ClientBuilder as reqwest_ClientBuilder;
|
use reqwest::ClientBuilder as reqwest_ClientBuilder;
|
||||||
use rust_socketio::asynchronous::{Client, ClientBuilder};
|
use rust_socketio::asynchronous::{Client, ClientBuilder};
|
||||||
use rust_socketio::{Event, Payload, TransportType};
|
use rust_socketio::{Event, Payload, TransportType};
|
||||||
use serde_json::{from_str, from_value, json, Value};
|
use serde_json::{json, Value};
|
||||||
use tracing::{event, span, Level};
|
use tracing::{event, span, Level};
|
||||||
|
|
||||||
use crate::config::TailchatConfig;
|
use crate::config::TailchatConfig;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use rust_socketio::asynchronous::Client;
|
||||||
|
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use tracing::{debug, info, span, warn, Level};
|
use tracing::{debug, warn};
|
||||||
|
|
||||||
pub async fn send_message(client: &Client, message: &SendingMessage) -> bool {
|
pub async fn send_message(client: &Client, message: &SendingMessage) -> bool {
|
||||||
let value: Value = message.as_value();
|
let value: Value = message.as_value();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user