Rustendo/src/util/embed.rs

29 lines
730 B
Rust

use std::fmt::Display;
use chrono::Local;
use serenity::all::{CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter};
pub struct Embed;
impl Embed {
pub fn create<
S: Into<String> + Display,
T: Into<String> + Display,
U: Into<String> + Display,
>(
username: S,
title: T,
message: U,
) -> CreateEmbed {
let current_time = Local::now().format("%Y-%m-%d @ %H:%M:%S");
CreateEmbed::new()
.author(CreateEmbedAuthor::new(username.to_string()))
.title(title)
.description(message)
.footer(CreateEmbedFooter::new(format!(
"> {} | {}",
current_time, username
)))
}
}