From 98ffb28eb2937e7c3cb7c8457d0534598875407a Mon Sep 17 00:00:00 2001 From: Zoey Date: Mon, 22 Apr 2024 22:06:15 -0700 Subject: [PATCH] add missing command docs --- src/command.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command.rs b/src/command.rs index dcd447b..40345ae 100644 --- a/src/command.rs +++ b/src/command.rs @@ -21,8 +21,10 @@ pub enum Command<'m> { } impl<'m> Command<'m> { + /// the prefix for commands pub const PREFIX: char = '/'; + /// parses a command, returning the parsed command or an error to be displayed to the player who sent the command pub fn parse(input: &'m str) -> Result { let (command_name, mut arguments) = input.split_once(' ').unwrap_or((input, "")); Ok(match command_name { @@ -36,6 +38,7 @@ impl<'m> Command<'m> { }) } + /// checks which permissions are required to run this command pub fn perms_required(&self) -> PlayerType { match self { Self::Me { .. } => PlayerType::Normal, @@ -43,6 +46,7 @@ impl<'m> Command<'m> { } } + /// gets the next string argument from the command fn next_string(args: &mut &'m str) -> Result<&'m str, String> { if args.is_empty() { return Err("Missing argument".to_string());