summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorseth <[email protected]>2024-05-02 20:29:12 -0400
committerseth <[email protected]>2024-05-02 20:29:12 -0400
commita1876d5a6d47f9bf8fb78be4162d6a7d7fa90d16 (patch)
tree7d8fd1efd7896664a4952d9f25976aeb6247dee3 /src
parent7d4fa29a63c3ff558a88fdacbed7d02cf805f4f9 (diff)
feat: add pfp command
Diffstat (limited to 'src')
-rw-r--r--src/commands/general/bing.rs2
-rw-r--r--src/commands/general/mod.rs1
-rw-r--r--src/commands/general/pfp.rs24
-rw-r--r--src/commands/mod.rs2
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),