summaryrefslogtreecommitdiff
path: root/src/command/ping.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2024-05-27 04:55:45 -0400
committerseth <[email protected]>2024-05-27 04:56:48 -0400
commitc69eea2f4823da476628742fbbec600ee95ac049 (patch)
tree7cf3d87f5f202e6049ba44a06ac6fe9d3558826b /src/command/ping.rs
initial commit
Diffstat (limited to 'src/command/ping.rs')
-rw-r--r--src/command/ping.rs23
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)
+}