Do not try to call Codeforces API when there's no channels to send

This commit is contained in:
Natsu Kagami 2020-02-13 16:57:44 -05:00
parent b20c4868a7
commit 0b60396f81
Signed by: nki
GPG key ID: 73376E117CD20735

View file

@ -58,11 +58,11 @@ fn update_user(
cfu.rating = info.rating;
let mut send_message = |rc: RatingChange| -> CommandResult {
let (contest, _, _) =
codeforces::Contest::standings(reqwest, rc.contest_id, |f| f.limit(1, 1))?;
let channels =
channels_list.get_or_insert_with(|| channels.channels_of(http.clone(), user_id));
for channel in channels {
if channels.is_empty() { return Ok(()); }
let (contest, _, _) =
codeforces::Contest::standings(reqwest, rc.contest_id, |f| f.limit(1, 1))?; for channel in channels {
if let Err(e) = channel.send_message(http.http(), |e| {
e.content(format!("Rating change for {}!", user_id.mention()))
.embed(|c| {