更新依赖库和修改函数命名
This commit is contained in:
parent
8cd8d93a28
commit
c83a2c4549
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -47,6 +47,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "as_variant"
|
||||
version = "1.2.0"
|
||||
@ -641,6 +650,7 @@ dependencies = [
|
||||
name = "ica-rs"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"colored",
|
||||
"ed25519",
|
||||
|
@ -37,6 +37,7 @@ colored = "2.1.0"
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
futures-util = "0.3.30"
|
||||
pyo3 = "0.20.3"
|
||||
anyhow = { version = "1.0.81", features = ["backtrace"] }
|
||||
# async 这玩意以后在搞
|
||||
# pyo3-async = "0.3.2"
|
||||
# pyo3-asyncio = { version = "0.20.0", features = ["attributes", "tokio-runtime"] }
|
||||
|
@ -38,7 +38,7 @@ pub async fn add_message(payload: Payload, client: Client) {
|
||||
send_message(&client, &reply).await;
|
||||
}
|
||||
// python 插件
|
||||
py::call::new_message_py(&message, &client).await;
|
||||
py::call::ica_new_message_py(&message, &client).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ pub async fn delete_message(payload: Payload, client: Client) {
|
||||
if let Some(msg_id) = value.as_str() {
|
||||
info!("delete_message {}", msg_id.to_string().yellow());
|
||||
|
||||
py::call::delete_message_py(msg_id.to_string(), &client).await;
|
||||
py::call::ica_delete_message_py(msg_id.to_string(), &client).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ pub fn verify_plugins() {
|
||||
}
|
||||
|
||||
/// 执行 new message 的 python 插件
|
||||
pub async fn new_message_py(message: &NewMessage, client: &Client) {
|
||||
pub async fn ica_new_message_py(message: &NewMessage, client: &Client) {
|
||||
// 验证插件是否改变
|
||||
verify_plugins();
|
||||
|
||||
@ -100,7 +100,7 @@ pub async fn new_message_py(message: &NewMessage, client: &Client) {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn delete_message_py(msg_id: MessageId, client: &Client) {
|
||||
pub async fn ica_delete_message_py(msg_id: MessageId, client: &Client) {
|
||||
verify_plugins();
|
||||
|
||||
let plugins = PyStatus::get_files();
|
||||
|
@ -219,9 +219,7 @@ pub fn load_py_plugins(path: &PathBuf) {
|
||||
);
|
||||
}
|
||||
|
||||
pub fn get_change_time(path: &PathBuf) -> Option<SystemTime> {
|
||||
path.metadata().ok()?.modified().ok()
|
||||
}
|
||||
pub fn get_change_time(path: &Path) -> Option<SystemTime> { path.metadata().ok()?.modified().ok() }
|
||||
|
||||
pub fn py_module_from_code(content: &str, path: &Path) -> PyResult<Py<PyAny>> {
|
||||
Python::with_gil(|py| -> PyResult<Py<PyAny>> {
|
||||
|
Loading…
Reference in New Issue
Block a user