This commit is contained in:
Raptorox 2026-08-01 13:40:59 +02:00
parent 72a0cf8c69
commit 958a6718eb
No known key found for this signature in database
GPG key ID: 8B3556FC3ED1F6D8

26
src/command/ban.rs Normal file
View file

@ -0,0 +1,26 @@
#[derive(Default)]
pub struct BanCommand {
target: Option<super::Selector>,
reason: Option<String>
}
impl BanCommand {
pub fn target(mut self, target: super::Selector) -> Self {
self.target = Some(target);
self
}
pub fn reason(mut self, reason: impl Into<String>) -> Self {
self.reason = Some(reason.into());
self
}
pub fn build(self) -> super::Command {
let target = self.target.unwrap_or(super::Selector::Player("nonexistent".to_string()));
let mut s = format!("ban {target}");
if let Some(reason) = self.reason {
s.push_str(&format!(" {reason}"));
};
super::Command(s)
}
}