aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-07-24 15:42:36 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-07-24 15:42:36 +0200
commitec37b994114226829841c250d1170ce4053d99a7 (patch)
tree8d899d603ae37de574621455f0dc0d3681121e66 /src
parenta08e68e130f060dea7bcaf582c2419c3f71ab022 (diff)
downloadezau-ec37b994114226829841c250d1170ce4053d99a7.tar.gz
ezau-ec37b994114226829841c250d1170ce4053d99a7.tar.bz2
ezau-ec37b994114226829841c250d1170ce4053d99a7.zip
use Analyzer::outcome for Discord checkmarks
This is way more accurate than Log::was_rewarded, especially for repeated kills in a week.
Diffstat (limited to 'src')
-rw-r--r--src/discord.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/discord.rs b/src/discord.rs
index 32cbf16..839b1c8 100644
--- a/src/discord.rs
+++ b/src/discord.rs
@@ -2,7 +2,7 @@ use std::sync::Arc;
use anyhow::Result;
use chrono::prelude::*;
-use evtclib::Log;
+use evtclib::{Log, Outcome};
use serenity::client::bridge::gateway::ShardManager;
use serenity::model::id::*;
use serenity::prelude::*;
@@ -110,9 +110,10 @@ fn insert_link(text: &str, log: &Log, link: &str) -> String {
}
fn state_emoji(log: &Log) -> &'static str {
- if log.was_rewarded() {
- "✅"
- } else {
- "❌"
+ let outcome = log.analyzer().and_then(|a| a.outcome());
+ match outcome {
+ Some(Outcome::Success) => "✅",
+ Some(Outcome::Failure) => "❌",
+ None => "❓",
}
}