Compare commits

..

2 Commits

Author SHA1 Message Date
projectmoon e553472b7a Update readme for user variables regarding Call Of Cthulhu.
continuous-integration/drone/push Build is passing Details
2021-05-13 22:35:08 +00:00
projectmoon 2096af2512 Show username pill when executing multiple commands. 2021-05-13 22:31:38 +00:00
3 changed files with 13 additions and 3 deletions

View File

@ -145,8 +145,11 @@ Examples:
!get myvar //will print 5
```
Variables can be referenced in dice pool rolling expressions, for
example `!pool myvar` or `!pool myvar+3`.
Variables can be referenced in dice pool and Call of Cthulhu rolling
expressions, for example `!pool myvar` or `!pool myvar+3` or `!cthroll
myvar`. The Call of Cthulhu advancement roll also accepts variables,
and if a variable is used, and the roll is successful, it will update
the variable with the new skill.
## Running the Bot

View File

@ -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 {

View File

@ -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/>"),