feat: add assets for discord embedded messages
This commit is contained in:
parent
e225ffe997
commit
5183130427
6 changed files with 99 additions and 5 deletions
|
|
@ -18,16 +18,17 @@ struct AppState {
|
|||
}
|
||||
|
||||
fn build_embed(status: &str, timestamp: u64) -> CreateEmbed {
|
||||
let (colour, title, description) = match status {
|
||||
"open" => (Colour::from_rgb(87, 242, 135), "Door is open", "The door at Noisebridge is open."),
|
||||
"closed" => (Colour::from_rgb(237, 66, 69), "Door is closed", "The door at Noisebridge is closed."),
|
||||
_ => (Colour::from_rgb(153, 170, 181), "Pi is offline", "The Noisebridge Pi is offline."),
|
||||
let (colour, title, description, image_url) = match status {
|
||||
"open" => (Colour::from_rgb(0, 255, 0), "Noisebridge is Open!", "It's time to start hacking.", "https://noisebell.extremist.software/image/open.png"),
|
||||
"closed" => (Colour::from_rgb(255, 0, 0), "Noisebridge is Closed!", "We'll see you again soon.", "https://noisebell.extremist.software/image/closed.png"),
|
||||
_ => (Colour::from_rgb(153, 170, 181), "Noisebridge is Offline", "The Noisebridge Pi is not responding.", "https://noisebell.extremist.software/image/offline.png"),
|
||||
};
|
||||
|
||||
CreateEmbed::new()
|
||||
.title(title)
|
||||
.description(description)
|
||||
.colour(colour)
|
||||
.thumbnail(image_url)
|
||||
.timestamp(serenity::model::Timestamp::from_unix_timestamp(timestamp as i64).unwrap_or_else(|_| serenity::model::Timestamp::now()))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue