Forward RSS logs to the Discord channel
All checks were successful
Build and push container image / build (push) Successful in 13m30s

This commit is contained in:
toast 2024-08-01 19:06:39 +10:00
parent 09fccc1328
commit c3e7a669ac
2 changed files with 41 additions and 6 deletions

View File

@ -5,6 +5,7 @@ pub struct ConfigMeta {
pub embed_color: i32,
pub ready_notify: u64,
pub rss_channel: u64,
pub kon_logs: u64,
pub deploy_commands: bool,
pub developers: Vec<u64>
}
@ -29,6 +30,7 @@ impl ConfigMeta {
embed_color: 0x5a99c7,
ready_notify: 865673694184996888,
rss_channel: 865673694184996888,
kon_logs: 1268493237912604672,
deploy_commands: false,
developers: vec![
190407856527376384 // toast.ts

View File

@ -280,8 +280,19 @@ pub async fn rss(ctx: Arc<Context>) -> Result<(), Error> {
Ok(Some(embed)) => {
ChannelId::new(BINARY_PROPERTIES.rss_channel).send_message(&ctx.http, CreateMessage::new().add_embed(embed)).await.unwrap();
},
Ok(None) => (),
Err(y) => task_err(&task_name, &y.to_string())
Ok(None) => {
ChannelId::new(BINARY_PROPERTIES.kon_logs).send_message(
&ctx.http, CreateMessage::new()
.content("**[RSS:ESXi]:** Article returned no new content.")
).await.unwrap();
},
Err(y) => {
ChannelId::new(BINARY_PROPERTIES.kon_logs).send_message(
&ctx.http, CreateMessage::new()
.content(format!("**[RSS:ESXi:Error]:** Feed failed with the following error:```\n{}\n```", y))
).await.unwrap();
task_err(&task_name, &y.to_string())
}
}
match gportal_embed().await {
@ -290,16 +301,38 @@ pub async fn rss(ctx: Arc<Context>) -> Result<(), Error> {
.content("*Uh-oh! G-Portal is having issues!*").add_embed(embed)
).await.unwrap();
},
Ok(None) => (),
Err(y) => task_err(&task_name, &y.to_string())
Ok(None) => {
ChannelId::new(BINARY_PROPERTIES.kon_logs).send_message(
&ctx.http, CreateMessage::new()
.content("**[RSS:GPortal]:** Article returned no new content.")
).await.unwrap();
},
Err(y) => {
ChannelId::new(BINARY_PROPERTIES.kon_logs).send_message(
&ctx.http, CreateMessage::new()
.content(format!("**[RSS:GPortal:Error]:** Feed failed with the following error:```\n{}\n```", y))
).await.unwrap();
task_err(&task_name, &y.to_string())
}
}
match rust_message().await {
Ok(Some(content)) => {
ChannelId::new(BINARY_PROPERTIES.rss_channel).send_message(&ctx.http, CreateMessage::new().content(content)).await.unwrap();
},
Ok(None) => (),
Err(y) => task_err(&task_name, &y.to_string())
Ok(None) => {
ChannelId::new(BINARY_PROPERTIES.kon_logs).send_message(
&ctx.http, CreateMessage::new()
.content("**[RSS:RustBlog]:** Article returned no new content.")
).await.unwrap();
},
Err(y) => {
ChannelId::new(BINARY_PROPERTIES.kon_logs).send_message(
&ctx.http, CreateMessage::new()
.content(format!("**[RSS:RustBlog:Error]:** Feed failed with the following error:```\n{}\n```", y))
).await.unwrap();
task_err(&task_name, &y.to_string())
}
}
}
}