blob: 2ad062b5e3eddfd9ef88e02e1f598ed1b1c05e08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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(())
}
|