summaryrefslogtreecommitdiff
path: root/crates/bot-commands/src/ping.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/bot-commands/src/ping.rs')
-rw-r--r--crates/bot-commands/src/ping.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/bot-commands/src/ping.rs b/crates/bot-commands/src/ping.rs
new file mode 100644
index 0000000..b18a0b6
--- /dev/null
+++ b/crates/bot-commands/src/ping.rs
@@ -0,0 +1,21 @@
+use bot_error::Error;
+
+use serenity::builder::{
+ CreateCommand, CreateInteractionResponse, CreateInteractionResponseMessage,
+};
+use serenity::model::application::{CommandInteraction, InstallationContext};
+use serenity::prelude::Context;
+
+pub async fn respond(ctx: &Context, command: &CommandInteraction) -> Result<(), Error> {
+ 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)
+}