diff --git a/youmubot-osu/src/discord/announcer.rs b/youmubot-osu/src/discord/announcer.rs index bcd5a4c..5409980 100644 --- a/youmubot-osu/src/discord/announcer.rs +++ b/youmubot-osu/src/discord/announcer.rs @@ -183,7 +183,10 @@ impl Announcer { let recents = recents .into_iter() .inspect(|v| { - if let Some(mp) = v.to_event_mapping() { + if let Some(mp) = v.to_event_mapping().filter(|s| { + let lu = last_update.values().max().cloned(); + Self::is_announceable_date(s.date, lu, now) + }) { mapping_events.push(mp); } }) @@ -191,8 +194,7 @@ impl Announcer { .filter(|s| Self::is_worth_announcing(s)) .filter(|s| { let lu = last_update.get(&s.mode).cloned(); - let f = Self::is_announceable_date(s.date, lu, now); - f + Self::is_announceable_date(s.date, lu, now) }) .map(|e| CollectedScore::from_event(&env.client, header.clone(), e)) .collect::>() diff --git a/youmubot-osu/src/models/rosu.rs b/youmubot-osu/src/models/rosu.rs index d527548..d6085bd 100644 --- a/youmubot-osu/src/models/rosu.rs +++ b/youmubot-osu/src/models/rosu.rs @@ -20,7 +20,7 @@ impl ApprovalStatus { } } -pub(super) fn time_to_utc(s: time::OffsetDateTime) -> DateTime { +pub fn time_to_utc(s: time::OffsetDateTime) -> DateTime { chrono::DateTime::from_timestamp(s.unix_timestamp(), 0).unwrap() }