Better infos

This commit is contained in:
Oupson 2020-08-24 21:24:39 +02:00
parent b9627ba69b
commit 1deef4a08f
2 changed files with 38 additions and 18 deletions

View File

@ -155,23 +155,44 @@ async fn _older(ctx: &Context, msg: &Message, mut args: Args) -> crate::commands
#[command]
#[description = "Print bot infos"]
async fn infos(ctx: &Context, msg: &Message) -> CommandResult {
let res = format!(
"{} v{}, by {}\nFeatures : {:?}\nMode : {}",
let current_user = ctx.http.get_current_user().await;
msg.channel_id
.send_message(ctx, |m| {
m.embed(|e| {
e.title(format!(
"{} v{}, by {}",
option_env!("CARGO_PKG_NAME").unwrap_or("unknown"),
option_env!("CARGO_PKG_VERSION").unwrap_or("unknown"),
option_env!("CARGO_PKG_AUTHORS").unwrap_or("unknows"),
option_env!("CARGO_PKG_AUTHORS").unwrap_or("unknows")
))
.description(format!(
concat!(
"Features : {:?}\n",
"Mode : {}\n",
"Source code : https://git.oupsman.fr/oupson/discord_rusty_bot"
),
get_features(),
{
if cfg!(debug_assertions) {
"debug"
} else {
"release"
},
))
.colour((247, 76, 0))
.footer(|f| {
if let Ok(user) = &current_user {
let mut f = f.text(&user.name);
if let Some(avatar) = user.avatar_url() {
f = f.icon_url(avatar);
}
f
} else {
f
}
);
if let Err(e) = api::send_splitted_by_lines_in_card(ctx, msg, res).await {
eprintln!("Error when sending bot infos : {:?}", e);
}
})
})
})
.await?;
Ok(())
}

View File

@ -115,7 +115,6 @@ fn bullet_to_str<'m>(nbr: u8) -> &'m str {
}
}
// TODO ALLOW ADMINS TO DISABLE THAT
#[command]
#[description = "DO IT"]