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] #[command]
#[description = "Print bot infos"] #[description = "Print bot infos"]
async fn infos(ctx: &Context, msg: &Message) -> CommandResult { async fn infos(ctx: &Context, msg: &Message) -> CommandResult {
let res = format!( let current_user = ctx.http.get_current_user().await;
"{} v{}, by {}\nFeatures : {:?}\nMode : {}", 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_NAME").unwrap_or("unknown"),
option_env!("CARGO_PKG_VERSION").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(), get_features(),
{
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
"debug" "debug"
} else { } else {
"release" "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(()) Ok(())
} }

View File

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