forked from projectmoon/tenebrous-dicebot
bot: Move multi-failure response join() call into the format!().
This commit is contained in:
parent
304c91c69d
commit
b0707dff05
|
@ -83,18 +83,17 @@ async fn handle_multiple_results(
|
||||||
let message = if errors.len() == 0 {
|
let message = if errors.len() == 0 {
|
||||||
format!("{}: Executed {} commands", respond_to, results.len())
|
format!("{}: Executed {} commands", respond_to, results.len())
|
||||||
} else {
|
} else {
|
||||||
let failures: String = errors
|
let failures: Vec<String> = errors
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&(cmd, err)| format!("<strong>{}:</strong> {}", cmd, err))
|
.map(|&(cmd, err)| format!("<strong>{}:</strong> {}", cmd, err))
|
||||||
.collect::<Vec<_>>()
|
.collect();
|
||||||
.join("\n");
|
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
"{}: Executed {} commands ({} failed)\n\nFailures:\n{}",
|
"{}: Executed {} commands ({} failed)\n\nFailures:\n{}",
|
||||||
respond_to,
|
respond_to,
|
||||||
results.len(),
|
results.len(),
|
||||||
errors.len(),
|
errors.len(),
|
||||||
failures
|
failures.join("\n")
|
||||||
)
|
)
|
||||||
.replace("\n", "<br/>")
|
.replace("\n", "<br/>")
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue