From c69eea2f4823da476628742fbbec600ee95ac049 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 27 May 2024 04:55:45 -0400 Subject: initial commit --- src/command/ping.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/command/ping.rs (limited to 'src/command/ping.rs') diff --git a/src/command/ping.rs b/src/command/ping.rs new file mode 100644 index 0000000..1b1b812 --- /dev/null +++ b/src/command/ping.rs @@ -0,0 +1,23 @@ +use eyre::Result; +use serenity::builder::{ + CreateCommand, CreateInteractionResponse, CreateInteractionResponseMessage, +}; +use serenity::model::application::{CommandInteraction, InstallationContext}; +use serenity::prelude::Context; +use tracing::{instrument, trace}; + +#[instrument] +pub async fn respond(ctx: &Context, command: &CommandInteraction) -> Result<()> { + trace!("Responding to ping command"); + let message = CreateInteractionResponseMessage::new().content("Pong!"); + let response = CreateInteractionResponse::Message(message); + command.create_response(&ctx, response).await?; + + Ok(()) +} + +pub fn register() -> CreateCommand { + CreateCommand::new("ping") + .description("Check if the bot is up") + .add_integration_type(InstallationContext::User) +} -- cgit v1.2.3