cleared up imports, split command help into separate function, postponed some awaits
This commit is contained in:
31
src/main.rs
31
src/main.rs
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user