Show long results properly

This commit is contained in:
Sakuhl 2018-01-28 16:50:24 +01:00
parent d06f3755f5
commit 6f9f1d069e

View File

@ -113,7 +113,9 @@ pub fn wc_crop(command: &str, msg: &Message) -> Result<(), Error> {
let client = reqwest::ClientBuilder::new().timeout(::std::time::Duration::from_secs(10000)).build().unwrap(); let client = reqwest::ClientBuilder::new().timeout(::std::time::Duration::from_secs(10000)).build().unwrap();
let new_url = client.get(&format!("https://wynncraft-autocrop.herokuapp.com/crop?url={}", url)).send()?.text().unwrap(); let new_url = client.get(&format!("https://wynncraft-autocrop.herokuapp.com/crop?url={}", url)).send()?.text().unwrap();
if new_url.starts_with("https://res.cloudinary.com") { if new_url.starts_with("https://res.cloudinary.com") {
msg.channel_id.say(&new_url)?; for chunk in new_url.split(' ').collect::<Vec<_>>().chunks(21) {
msg.channel_id.say(&chunk.join(" "))?;
}
} else { } else {
bail!(failure::err_msg("could not crop image")); bail!(failure::err_msg("could not crop image"));
} }