From db4f7f93691753ebf8ba05b3d0ce1f9cf637615d Mon Sep 17 00:00:00 2001 From: Raptorox <70806316+Raptorox@users.noreply.github.com> Date: Mon, 27 Jul 2026 23:34:43 +0200 Subject: [PATCH] add say --- src/command/mod.rs | 17 +++++++++++++++++ src/command/say.rs | 17 +++++++++++++++++ src/lib.rs | 5 ++++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/command/mod.rs create mode 100644 src/command/say.rs 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