diff --git a/src/command/mod.rs b/src/command/mod.rs new file mode 100644 index 0000000..8ad9ea7 --- /dev/null +++ b/src/command/mod.rs @@ -0,0 +1,17 @@ +pub struct Command(String); + +mod say; + +impl Command { + pub fn raw(cmd: &str) -> Self { + Self(cmd.to_string()) + } + + pub fn as_str(&self) -> &str { + &self.0 + } + + pub fn say() -> say::SayCommand { + say::SayCommand::default() + } +} \ No newline at end of file diff --git a/src/command/say.rs b/src/command/say.rs new file mode 100644 index 0000000..a395e56 --- /dev/null +++ b/src/command/say.rs @@ -0,0 +1,17 @@ +#[derive(Default)] +pub struct SayCommand { + message: String +} + +impl SayCommand { + pub fn message(mut self, msg: impl Into) -> Self { + self.message = msg.into(); + self + } + + pub fn build(self) -> super::Command { + let message= self.message; + let s = format!("say {message}"); + super::Command(s) + } +} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 79ffb8d..b80ff33 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,5 @@ mod client; -pub use client::{RconClient, RconError, RconResult}; \ No newline at end of file +pub use client::{RconClient, RconError, RconResult}; + +mod command; +pub use command::Command; \ No newline at end of file