reee
This commit is contained in:
parent
4753df8ded
commit
4479002b8d
@ -76,8 +76,9 @@ impl BotConfig {
|
||||
pub fn new_from_path(config_file_path: String) -> Self {
|
||||
// try read config from file
|
||||
let config = fs::read_to_string(&config_file_path).expect("Failed to read config file");
|
||||
let ret: Self = from_str(&config)
|
||||
.unwrap_or_else(|_| panic!("Failed to parse config file {}", &config_file_path));
|
||||
let ret: Self = from_str(&config).unwrap_or_else(|e| {
|
||||
panic!("Failed to parse config file {}\ne:{:?}", &config_file_path, e)
|
||||
});
|
||||
ret
|
||||
}
|
||||
pub fn new_from_cli() -> Self {
|
||||
|
@ -52,6 +52,7 @@ pub async fn start_ica(config: &IcaConfig, stop_reciver: StopGetter) -> ClientRe
|
||||
*room,
|
||||
None,
|
||||
);
|
||||
// 这可是 qq, 要保命
|
||||
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||
|
||||
event!(Level::INFO, "发送启动消息到房间: {}", room);
|
||||
|
@ -96,13 +96,19 @@ pub async fn start_tailchat(
|
||||
event!(Level::INFO, "{}", "tailchat 已经加入房间".green());
|
||||
|
||||
if config.notice_start {
|
||||
for (group, room) in config.notice_room {
|
||||
event!(Level::INFO, "正在发送启动消息");
|
||||
for (group, con) in config.notice_room {
|
||||
event!(Level::INFO, "发送启动消息到: {}|{}", con, group);
|
||||
let startup_msg =
|
||||
crate::data_struct::tailchat::messages::SendingMessage::new_without_meta(
|
||||
"ica-rs 启动成功".to_string(),
|
||||
group.clone(),
|
||||
Some(room.clone()),
|
||||
con.clone(),
|
||||
Some(group.clone()),
|
||||
);
|
||||
// 反正是 tailchat, 不需要等, 直接发
|
||||
if let Err(e) = socket.emit("chat.message.sendMessage", startup_msg.as_value()).await {
|
||||
event!(Level::ERROR, "发送启动消息失败: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user