Add debug logs
This commit is contained in:
parent
dfa1ae75b2
commit
cb660d13f4
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1023,7 +1023,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kon"
|
name = "kon"
|
||||||
version = "0.3.17"
|
version = "0.3.18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bb8",
|
"bb8",
|
||||||
"bb8-postgres",
|
"bb8-postgres",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kon"
|
name = "kon"
|
||||||
version = "0.3.17"
|
version = "0.3.18"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -3,7 +3,7 @@ mod processor; // Process the feeds and send it off to Discord
|
|||||||
mod esxi;
|
mod esxi;
|
||||||
mod github;
|
mod github;
|
||||||
mod gportal;
|
mod gportal;
|
||||||
mod rust_msg;
|
mod rust;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Error,
|
Error,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use super::{
|
use super::{
|
||||||
|
task_info,
|
||||||
task_err,
|
task_err,
|
||||||
TASK_NAME,
|
TASK_NAME,
|
||||||
BINARY_PROPERTIES,
|
BINARY_PROPERTIES,
|
||||||
@ -6,7 +7,7 @@ use super::{
|
|||||||
esxi::esxi_embed,
|
esxi::esxi_embed,
|
||||||
github::github_embed,
|
github::github_embed,
|
||||||
gportal::gportal_embed,
|
gportal::gportal_embed,
|
||||||
rust_msg::rust_message
|
rust::rust_message
|
||||||
};
|
};
|
||||||
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
@ -57,21 +58,15 @@ pub async fn feed_processor(ctx: &Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if Regex::new(r"(?i)\bresolved\b").unwrap().is_match(&new_desc) {
|
if Regex::new(r"(?i)\bresolved\b").unwrap().is_match(&new_desc) {
|
||||||
|
task_info(TASK_NAME, &format!("GPortal func, replying to message id: {}", msg_id));
|
||||||
message.reply(&ctx.http, "This incident has been marked as resolved!").await.unwrap();
|
message.reply(&ctx.http, "This incident has been marked as resolved!").await.unwrap();
|
||||||
redis.del(&rkey).await.unwrap();
|
redis.del(&rkey).await.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// If the message is invalid ID, send a new message instead
|
|
||||||
let message = channel.send_message(&ctx.http, CreateMessage::new()
|
|
||||||
.content("*Uh-oh! G-Portal is having issues!*").add_embed(embed)
|
|
||||||
).await.unwrap();
|
|
||||||
redis.set(&rkey, &message.id.to_string()).await.unwrap();
|
|
||||||
redis.expire(&rkey, 36000).await.unwrap();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Ok(None) | Err(_) => {
|
Ok(None) | Err(_) => {
|
||||||
// If the message is not found, send a new message instead
|
// If the message is invalid ID, send a new message instead
|
||||||
let message = channel.send_message(&ctx.http, CreateMessage::new()
|
let message = channel.send_message(&ctx.http, CreateMessage::new()
|
||||||
.content("*Uh-oh! G-Portal is having issues!*").add_embed(embed)
|
.content("*Uh-oh! G-Portal is having issues!*").add_embed(embed)
|
||||||
).await.unwrap();
|
).await.unwrap();
|
||||||
@ -109,15 +104,11 @@ pub async fn feed_processor(ctx: &Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if Regex::new(r"(?i)\bresolved\b").unwrap().is_match(&new_desc) {
|
if Regex::new(r"(?i)\bresolved\b").unwrap().is_match(&new_desc) {
|
||||||
|
task_info(TASK_NAME, &format!("GitHub func, replying to message id: {}", msg_id));
|
||||||
message.reply(&ctx.http, "This incident has been marked as resolved!").await.unwrap();
|
message.reply(&ctx.http, "This incident has been marked as resolved!").await.unwrap();
|
||||||
redis.del(&rkey).await.unwrap();
|
redis.del(&rkey).await.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// If the message is invalid ID, send a new message instead
|
|
||||||
let message = channel.send_message(&ctx.http, CreateMessage::new().add_embed(embed)).await.unwrap();
|
|
||||||
redis.set(&rkey, &message.id.to_string()).await.unwrap();
|
|
||||||
redis.expire(&rkey, 36000).await.unwrap();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Ok(None) | Err(_) => {
|
Ok(None) | Err(_) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user