perish command, misc

This commit is contained in:
2025-04-29 10:45:02 +02:00
parent 30dee784f6
commit 224d3866c8
3 changed files with 52 additions and 13 deletions

View File

@@ -1,2 +1,3 @@
pub mod kiss;
pub mod perish;
pub mod ping;

View File

@@ -0,0 +1,34 @@
use serenity::all::{
CommandInteraction, Context, CreateEmbed, CreateInteractionResponse,
CreateInteractionResponseMessage,
};
use serenity::builder::CreateCommand;
const PERISH_GIF_LINK: &str = "https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExbGM3NDRtaXQ0ZWk3enlybmwydHZmc3VwcWlzbXN1N2Zyc3Jpc2lmYSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/4kkOaBEy84jzD5ijGV/giphy.gif";
pub async fn run(ctx: &Context, interaction: &CommandInteraction) -> Result<(), serenity::Error> {
let caller_name = interaction
.member
.as_ref()
.map(|m| m.nick.clone().unwrap_or_else(|| m.user.name.clone()))
.unwrap_or_else(|| interaction.user.name.clone());
let embed = CreateEmbed::new()
.thumbnail(PERISH_GIF_LINK)
.title(format!("{caller_name} has perished!"))
.description("Oh the misery...")
.color(0xFF89B4);
interaction
.create_response(
&ctx.http,
CreateInteractionResponse::Message(
CreateInteractionResponseMessage::new().add_embed(embed),
),
)
.await
}
pub fn register() -> CreateCommand {
CreateCommand::new("perish").description("w proch się obróć.")
}