mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-16 07:18:54 +00:00
Do not try to call Codeforces API when there's no channels to send
This commit is contained in:
parent
b20c4868a7
commit
0b60396f81
1 changed files with 3 additions and 3 deletions
|
@ -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| {
|
||||
|
|
Loading…
Add table
Reference in a new issue