summary refs log tree commit diff
path: root/src/system/message_parser.rs
diff options
context:
space:
mode:
authorAshelyn Rose <git@ashen.earth>2024-11-07 20:07:25 -0700
committerAshelyn Rose <git@ashen.earth>2024-11-07 20:07:25 -0700
commita69d779cfff810edd375318c3d36fecd42d294b5 (patch)
treed51ce593e45a800bf63c5b41caf82df151f03245 /src/system/message_parser.rs
parentba9362908d2defa784a45c16bc142c66c3fab9a3 (diff)
Runtime ui
Diffstat (limited to 'src/system/message_parser.rs')
-rw-r--r--src/system/message_parser.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/system/message_parser.rs b/src/system/message_parser.rs
index 349ce0e..2c6d6d2 100644
--- a/src/system/message_parser.rs
+++ b/src/system/message_parser.rs
@@ -15,7 +15,7 @@ pub enum ParsedMessage {
         message_content: String,
         latch: bool,
     },
-    UnproxiedMessage,
+    UnproxiedMessage(Option<String>),
     LatchClear(MemberId),
 
     // TODO: Figure out how to represent emotes
@@ -28,6 +28,7 @@ pub enum Command {
     Reproxy(MemberId, MessageId),
     Delete(MessageId),
     Nick(MemberId, String),
+    Log(String),
     ReloadSystemConfig,
     ExitSéance,
     UnknownCommand,
@@ -51,13 +52,14 @@ impl MessageParser {
         }
 
         if message.content.starts_with(r"\") {
-            return ParsedMessage::UnproxiedMessage
+            return ParsedMessage::UnproxiedMessage(None)
         }
 
         if message.content.starts_with(r"!") {
             if let Some(parse) = MessageParser::check_command(message, secondary_message, system_config, latch_state) {
                 return ParsedMessage::Command(parse);
-
+            } else {
+                return ParsedMessage::UnproxiedMessage(Some(format!("Unknown command string: {}", message.content)));
             }
         }
 
@@ -76,7 +78,7 @@ impl MessageParser {
         }
 
         // If nothing else
-        ParsedMessage::UnproxiedMessage
+        ParsedMessage::UnproxiedMessage(None)
     }
 
     fn check_command(message: &FullMessage, secondary_message: Option<&FullMessage>, system_config: &System, latch_state: Option<(MemberId, Timestamp)>) -> Option<Command> {
@@ -86,6 +88,10 @@ impl MessageParser {
         match first_word {
             None => return None,
             Some(command_name) => match command_name {
+                "log" => {
+                    let remainder = words.remainder().unwrap().to_string();
+                    return Some(Command::Log(remainder));
+                },
                 "edit" => {
                     let editing_member = Self::get_member_id_from_user_id(secondary_message.as_ref().unwrap().author.id, system_config).unwrap();
                     return Some(Command::Edit(editing_member, secondary_message.unwrap().id, words.remainder().unwrap().to_string()));