diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands/general/bing.rs | 2 | ||||
| -rw-r--r-- | src/commands/general/mod.rs | 1 | ||||
| -rw-r--r-- | src/commands/general/pfp.rs | 24 | ||||
| -rw-r--r-- | src/commands/mod.rs | 2 |
4 files changed, 27 insertions, 2 deletions
diff --git a/src/commands/general/bing.rs b/src/commands/general/bing.rs index d58404e..54ee0dc 100644 --- a/src/commands/general/bing.rs +++ b/src/commands/general/bing.rs @@ -1,7 +1,5 @@ use crate::{Context, Error}; -use eyre::Result; - /// Make sure the wie is alive #[poise::command(prefix_command)] pub async fn bing(ctx: Context<'_>) -> Result<(), Error> { diff --git a/src/commands/general/mod.rs b/src/commands/general/mod.rs index 82af4d2..9bd3827 100644 --- a/src/commands/general/mod.rs +++ b/src/commands/general/mod.rs @@ -2,5 +2,6 @@ pub mod ask; pub mod bing; pub mod config; pub mod convert; +pub mod pfp; pub mod random; pub mod version; diff --git a/src/commands/general/pfp.rs b/src/commands/general/pfp.rs new file mode 100644 index 0000000..2ad062b --- /dev/null +++ b/src/commands/general/pfp.rs @@ -0,0 +1,24 @@ +use poise::{ + serenity_prelude::{CreateEmbed, User}, + CreateReply, +}; + +use crate::{consts::Colors, Context, Error}; + +/// Get someone's profile pic +#[poise::command(context_menu_command = "Get profile picture", slash_command)] +pub async fn pfp(ctx: Context<'_>, user: User) -> Result<(), Error> { + let url = user + .avatar_url() + .unwrap_or_else(|| user.default_avatar_url()); + let embed = CreateEmbed::new() + .title(user.name) + .color(Colors::Blue) + .url(&url) + .image(&url); + let reply = CreateReply::default().embed(embed); + + ctx.send(reply).await?; + + Ok(()) +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs index e55419b..51fe388 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -23,6 +23,7 @@ pub fn to_vec() -> Vec<Command> { cmd!(general, bing), cmd!(general, config), cmd!(general, convert), + cmd!(general, pfp), cmd!(general, random), cmd!(general, version), cmd!(moderation, clear_messages), @@ -38,6 +39,7 @@ pub fn to_vec_global() -> Vec<Command> { cmd!(general, bing), cmd!(general, config), cmd!(general, convert), + cmd!(general, pfp), cmd!(general, random), cmd!(general, version), cmd!(moderation, clear_messages), |
