From ef7508a456f8aceac7df221d4dd94e19a7044b32 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Wed, 17 May 2023 07:59:15 +0200 Subject: [PATCH] feat: move mc stuff to subcommand --- src/commands/minecraft.rs | 12 ++++++++++-- src/commands/mod.rs | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/commands/minecraft.rs b/src/commands/minecraft.rs index fbbedd9..b6250d4 100644 --- a/src/commands/minecraft.rs +++ b/src/commands/minecraft.rs @@ -3,9 +3,17 @@ use async_minecraft_ping::ServerDescription; const DEFAULT_SERVER: &str = "rustybever.be"; -/// Ping a minecraft server +/// Parent command for Minecraft-related actions. +/// +/// Minecraft-related commands +#[poise::command(prefix_command, slash_command, subcommands("ping"))] +pub async fn mc(_ctx: Context<'_>) -> Result<(), Error> { + Ok(()) +} + +/// Ping a minecraft server; defaults to our server. #[poise::command(prefix_command, slash_command)] -pub async fn ping_mc( +pub async fn ping( ctx: Context<'_>, #[description = "Address of the server"] address: Option, #[description = "Port the server runs on"] port: Option, diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 70a5dea..d04b01e 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -6,7 +6,7 @@ use crate::{Context, Data, Error}; type EmbedField = (String, String, bool); pub fn commands() -> Vec> { - vec![help(), affluence::available(), minecraft::ping_mc()] + vec![affluence::available(), minecraft::mc(), help()] } /// Show this help menu @@ -21,7 +21,7 @@ pub async fn help( ctx, command.as_deref(), poise::builtins::HelpConfiguration { - extra_text_at_bottom: "This is an example bot made to showcase features of my custom Discord bot framework", + extra_text_at_bottom: "Brought to you by Doofenshmirtz Evil Incorporated.", ..Default::default() }, )