fix(client): split long replies into multiple chunks
This commit is contained in:
parent
dde489a8ed
commit
2cba4d797f
@ -19,14 +19,22 @@ pub struct CommandSource {
|
||||
|
||||
impl CommandSource {
|
||||
pub fn reply(&self, message: &str) {
|
||||
let response = if self.message.is_whisper()
|
||||
for chunk in message
|
||||
.chars()
|
||||
.collect::<Vec<char>>()
|
||||
.chunks(236)
|
||||
.map(|chars| chars.iter().collect::<String>())
|
||||
{
|
||||
self.client.chat(
|
||||
&(if self.message.is_whisper()
|
||||
&& let Some(username) = self.message.username()
|
||||
{
|
||||
&format!("/w {username} {message}")
|
||||
format!("/w {username} {chunk}")
|
||||
} else {
|
||||
message
|
||||
};
|
||||
self.client.chat(response);
|
||||
chunk
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn _entity(&mut self) -> Option<Entity> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user