Skip to content

Commit

Permalink
Fix replying with an empty mistake list
Browse files Browse the repository at this point in the history
Have a cat as consolation: 🐈
  • Loading branch information
Scotsguy committed Sep 2, 2019
1 parent 568ade7 commit f20ca60
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,19 @@ impl EventHandler for Handler {
msg.id
);

let link = link.as_str().replacen("/p/", "/r/", 1);
let log = match get_log(&link) {
let link_raw = link.as_str().replacen("/p/", "/r/", 1);
let log = match get_log(&link_raw) {
Ok(o) => o,
Err(_) => return,
};
debug!("Content of log: {}", log);

let mistakes = common_mistakes(&log);

if mistakes.is_empty() {
info!("Didn't find any mistakes in log ({})", link.as_str());
return
}
debug!("Mistakes found: {:?}", mistakes);

if let Err(why) = msg.channel_id.send_message(&ctx.http, |m| {
Expand Down

0 comments on commit f20ca60

Please sign in to comment.