diff options
Diffstat (limited to 'src/command/ping.rs')
| -rw-r--r-- | src/command/ping.rs | 23 |
1 files changed, 23 insertions, 0 deletions
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) +} |
