diff options
| author | seth <[email protected]> | 2024-05-02 20:29:12 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-05-02 20:29:12 -0400 |
| commit | a1876d5a6d47f9bf8fb78be4162d6a7d7fa90d16 (patch) | |
| tree | 7d8fd1efd7896664a4952d9f25976aeb6247dee3 /src/commands/general/pfp.rs | |
| parent | 7d4fa29a63c3ff558a88fdacbed7d02cf805f4f9 (diff) | |
feat: add pfp command
Diffstat (limited to 'src/commands/general/pfp.rs')
| -rw-r--r-- | src/commands/general/pfp.rs | 24 |
1 files changed, 24 insertions, 0 deletions
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(()) +} |
