diff --git a/src/commands.rs b/src/commands.rs index cb38b18..29d8f4a 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -19,14 +19,22 @@ pub struct CommandSource { impl CommandSource { pub fn reply(&self, message: &str) { - let response = if self.message.is_whisper() - && let Some(username) = self.message.username() + for chunk in message + .chars() + .collect::>() + .chunks(236) + .map(|chars| chars.iter().collect::()) { - &format!("/w {username} {message}") - } else { - message - }; - self.client.chat(response); + self.client.chat( + &(if self.message.is_whisper() + && let Some(username) = self.message.username() + { + format!("/w {username} {chunk}") + } else { + chunk + }), + ); + } } pub fn _entity(&mut self) -> Option {