cleared up imports, split command help into separate function, postponed some awaits

This commit is contained in:
jude committed 2020-12-18 12:37:05 +00:00
1 parent 26825ff4e5
commit ca68b45ebe
5 files changed
+49 -45

No files matched your search

+31
View File
@@ -39,6 +39,7 @@ use crate::{
use serenity::futures::TryFutureExt;
use inflector::Inflector;
use log::info;
struct SQLPool;
@@ -343,3 +344,33 @@ pub async fn get_ctx_data(ctx: &&Context) -> (MySqlPool, Arc<LanguageManager>) {
(pool, lm)
}
async fn command_help(
ctx: &Context,
msg: &Message,
lm: Arc<LanguageManager>,
prefix: &str,
language: &str,
command_name: &str,
) {
let _ = msg
.channel_id
.send_message(ctx, |m| {
m.embed(move |e| {
e.title(format!("{} Help", command_name.to_title_case()))
.description(
lm.get(&language, &format!("help/{}", command_name))
.replace("{prefix}", &prefix),
)
.footer(|f| {
f.text(concat!(
env!("CARGO_PKG_NAME"),
" ver ",
env!("CARGO_PKG_VERSION")
))
})
.color(*THEME_COLOR)
})
})
.await;
}