summaryrefslogtreecommitdiff
path: root/crates/discord-bot/src/commands/ping.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/discord-bot/src/commands/ping.rs')
-rw-r--r--crates/discord-bot/src/commands/ping.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/discord-bot/src/commands/ping.rs b/crates/discord-bot/src/commands/ping.rs
new file mode 100644
index 0000000..30150dc
--- /dev/null
+++ b/crates/discord-bot/src/commands/ping.rs
@@ -0,0 +1,20 @@
+use eyre::Result;
+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<()> {
+ 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)
+}