Last active
November 18, 2017 21:50
-
-
Save Killavus/635b23be747cff8601e2a839dff8e75f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub enum Command<'a> { | |
ClaimSpawn { spawn_name: &'a str, message: Message }, | |
ClaimedList { message: Message }, | |
EstablishState { server_id: ServerId }, | |
Unknown, | |
} | |
impl<'a> Command<'a> { | |
fn from_message(message: Message) -> Self { | |
let content = message.content.trim(); | |
if content.starts_with("/claimedlist") { | |
Command::ClaimedList { message } | |
} else if content.starts_with("/claim") { | |
let spawn_name = content["/claim".len()..].trim(); | |
Command::ClaimSpawn { | |
spawn_name: spawn_name, | |
message | |
} | |
} else { | |
Command::Unknown | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment