feat: 修改通知器,支持提示成功任务数量 (#672)
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
use crate::bilibili::BiliClient;
|
||||
use crate::config::Config;
|
||||
use crate::notifier::NotifierAllExt;
|
||||
use crate::notifier::{Message, NotifierAllExt};
|
||||
|
||||
pub fn notify(config: &Config, bili_client: &BiliClient, msg: impl Into<Message<'static>>) {
|
||||
if let Some(notifiers) = &config.notifiers
|
||||
&& !notifiers.is_empty()
|
||||
{
|
||||
let (notifiers, inner_client) = (notifiers.clone(), bili_client.inner_client().clone());
|
||||
let msg = msg.into();
|
||||
tokio::spawn(async move { notifiers.notify_all(&inner_client, msg).await });
|
||||
}
|
||||
}
|
||||
|
||||
pub fn error_and_notify(config: &Config, bili_client: &BiliClient, msg: String) {
|
||||
error!("{msg}");
|
||||
@@ -8,6 +18,6 @@ pub fn error_and_notify(config: &Config, bili_client: &BiliClient, msg: String)
|
||||
&& !notifiers.is_empty()
|
||||
{
|
||||
let (notifiers, inner_client) = (notifiers.clone(), bili_client.inner_client().clone());
|
||||
tokio::spawn(async move { notifiers.notify_all(&inner_client, msg.as_str()).await });
|
||||
tokio::spawn(async move { notifiers.notify_all(&inner_client, msg).await });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user