summaryrefslogtreecommitdiff
path: root/src/command/ping.rs
blob: 1b1b812bc04c702c7b61df68b227a8d0e87d5798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)
}