feat: move mc stuff to subcommand

bib-booking
Jef Roosens 2023-05-17 07:59:15 +02:00
parent f8ce315d8e
commit ef7508a456
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 12 additions and 4 deletions

View File

@ -3,9 +3,17 @@ use async_minecraft_ping::ServerDescription;
const DEFAULT_SERVER: &str = "rustybever.be"; 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)] #[poise::command(prefix_command, slash_command)]
pub async fn ping_mc( pub async fn ping(
ctx: Context<'_>, ctx: Context<'_>,
#[description = "Address of the server"] address: Option<String>, #[description = "Address of the server"] address: Option<String>,
#[description = "Port the server runs on"] port: Option<u16>, #[description = "Port the server runs on"] port: Option<u16>,

View File

@ -6,7 +6,7 @@ use crate::{Context, Data, Error};
type EmbedField = (String, String, bool); type EmbedField = (String, String, bool);
pub fn commands() -> Vec<poise::structs::Command<Data, Error>> { pub fn commands() -> Vec<poise::structs::Command<Data, Error>> {
vec![help(), affluence::available(), minecraft::ping_mc()] vec![affluence::available(), minecraft::mc(), help()]
} }
/// Show this help menu /// Show this help menu
@ -21,7 +21,7 @@ pub async fn help(
ctx, ctx,
command.as_deref(), command.as_deref(),
poise::builtins::HelpConfiguration { 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() ..Default::default()
}, },
) )