diff --git a/src/botscript.rs b/src/botscript.rs index 04d3ac5..a1c99e5 100644 --- a/src/botscript.rs +++ b/src/botscript.rs @@ -501,10 +501,32 @@ pub struct BotMessage { /// flag options to command is meta, so it will be appended to user.metas in db meta: Option, + variants: Vec, handler: Option, } +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct MessageVariant(String); + +impl MessageVariant { + pub fn get_name(&self) -> &str { + &self.0 + } +} + +impl PartialEq for &MessageVariant { + fn eq(&self, other: &String) -> bool { + self.0 == *other + } +} + +impl PartialEq<&str> for &MessageVariant { + fn eq(&self, other: &&str) -> bool { + self.0 == *other + } +} + impl BotMessage { pub fn fill_literal(self, l: String) -> Self { BotMessage { @@ -542,6 +564,10 @@ impl BotMessage { pub fn meta(&self) -> bool { self.meta.unwrap_or(false) } + + pub fn variants(&self) -> &[MessageVariant] { + &self.variants + } } impl BotMessage {