This commit is contained in:
shenjack 2024-03-14 01:12:08 +08:00
parent c83a2c4549
commit 4ae11b4d4f
Signed by: shenjack
GPG Key ID: 7B1134A979775551
5 changed files with 32 additions and 24 deletions

2
Cargo.lock generated
View File

@ -648,7 +648,7 @@ dependencies = [
[[package]]
name = "ica-rs"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"anyhow",
"chrono",

View File

@ -1,6 +1,6 @@
[package]
name = "ica-rs"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -73,15 +73,11 @@ impl BotConfig {
pub fn check_ica(&self) -> bool {
match self.enable_ica {
Some(enable) => {
if enable {
if self.ica.is_none() {
warn!("enable_ica 为 true 但未填写 [ica] 配置\n将不启用 ica");
false
} else {
true
}
} else {
if enable && self.ica.is_none() {
warn!("enable_ica 为 true 但未填写 [ica] 配置\n将不启用 ica");
false
} else {
true
}
}
None => {
@ -97,15 +93,11 @@ impl BotConfig {
pub fn check_matrix(&self) -> bool {
match self.enable_matrix {
Some(enable) => {
if enable {
if self.matrix.is_none() {
warn!("enable_matrix 为 true 但未填写 [matrix] 配置\n将不启用 Matrix");
false
} else {
true
}
} else {
if enable && self.matrix.is_none() {
warn!("enable_matrix 为 true 但未填写 [matrix] 配置\n将不启用 Matrix");
false
} else {
true
}
}
None => {

View File

@ -7,19 +7,20 @@ mod ica;
#[cfg(feature = "matrix")]
mod matrix;
mod py;
mod status;
use config::BotConfig;
use tracing::info;
#[allow(non_upper_case_globals)]
pub static mut ClientStatus_Global: ica::client::BotStatus = ica::client::BotStatus {
login: false,
current_loaded_messages_count: 0,
online_data: None,
rooms: None,
pub static mut MAIN_STATUS: status::BotStatus = status::BotStatus {
config: None,
ica_status: None,
matrix_status: None,
};
pub type MainStatus = status::BotStatus;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[macro_export]

View File

@ -0,0 +1,15 @@
use crate::config::BotConfig;
pub struct BotStatus {
pub config: Option<BotConfig>,
pub ica_status: Option<ica::MainStatus>,
pub matrix_status: Option<matrix::MainStatus>,
}
pub mod ica {
pub struct MainStatus {}
}
pub mod matrix {
pub struct MainStatus {}
}