summaryrefslogtreecommitdiff
path: root/src/commands/general/pfp.rs
blob: 34ae79550a6e11c6736ce8a0ffc65967c317c8b6 (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
25
use crate::{client::Context, consts::Colors};

use eyre::Result;
use poise::{
	serenity_prelude::{CreateEmbed, User},
	CreateReply,
};

/// Get someone's profile pic
#[poise::command(context_menu_command = "Get profile picture", slash_command)]
pub async fn pfp(ctx: Context<'_>, user: User) -> Result<()> {
	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(())
}