Better infos
This commit is contained in:
parent
b9627ba69b
commit
1deef4a08f
|
@ -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 : {}",
|
||||
option_env!("CARGO_PKG_NAME").unwrap_or("unknown"),
|
||||
option_env!("CARGO_PKG_VERSION").unwrap_or("unknown"),
|
||||
option_env!("CARGO_PKG_AUTHORS").unwrap_or("unknows"),
|
||||
get_features(),
|
||||
{
|
||||
if cfg!(debug_assertions) {
|
||||
"debug"
|
||||
} else {
|
||||
"release"
|
||||
}
|
||||
}
|
||||
);
|
||||
if let Err(e) = api::send_splitted_by_lines_in_card(ctx, msg, res).await {
|
||||
eprintln!("Error when sending bot infos : {:?}", e);
|
||||
}
|
||||
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")
|
||||
))
|
||||
.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) = ¤t_user {
|
||||
let mut f = f.text(&user.name);
|
||||
if let Some(avatar) = user.avatar_url() {
|
||||
f = f.icon_url(avatar);
|
||||
}
|
||||
f
|
||||
} else {
|
||||
f
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,6 @@ fn bullet_to_str<'m>(nbr: u8) -> &'m str {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO ALLOW ADMINS TO DISABLE THAT
|
||||
#[command]
|
||||
#[description = "DO IT"]
|
||||
|
|
Loading…
Reference in New Issue