forked from projectmoon/tenebrous-dicebot
Show username pill when executing multiple commands.
This commit is contained in:
parent
490d17790a
commit
2096af2512
|
@ -73,6 +73,11 @@ async fn handle_multiple_results(
|
|||
respond_to: &str,
|
||||
room: &Joined,
|
||||
) {
|
||||
let respond_to = format!(
|
||||
"<a href=\"https://matrix.to/#/{}\">{}</a>",
|
||||
respond_to, respond_to
|
||||
);
|
||||
|
||||
let errors: Vec<(&str, &ExecutionError)> = results
|
||||
.into_iter()
|
||||
.filter_map(|(cmd, result)| match result {
|
||||
|
|
|
@ -76,11 +76,13 @@ pub trait ResponseExtractor {
|
|||
impl ResponseExtractor for ExecutionResult {
|
||||
/// Error message in bolded HTML.
|
||||
fn message_html(&self, username: &str) -> String {
|
||||
//TODO use user display name too
|
||||
// TODO use user display name too (element seems to render this
|
||||
// without display name)
|
||||
let username = format!(
|
||||
"<a href=\"https://matrix.to/#/{}\">{}</a>",
|
||||
username, username
|
||||
);
|
||||
|
||||
match self {
|
||||
Ok(resp) => format!("<p>{}</p><p>{}</p>", username, resp.html).replace("\n", "<br/>"),
|
||||
Err(e) => format!("<p>{}</p><p>{}</p>", username, e.html()).replace("\n", "<br/>"),
|
||||
|
|
Loading…
Reference in New Issue