diff options
author | Logan Hunt <logan.hunt@usu.edu> | 2023-02-01 16:02:49 -0700 |
---|---|---|
committer | Logan Hunt <logan.hunt@usu.edu> | 2023-02-01 16:02:49 -0700 |
commit | e05a6d36bb62dae878be254416e7652995e94602 (patch) | |
tree | 845dd8586707c3f0d234adc6350e9d91571c4bc3 /lib/chessh/discord | |
parent | fe5f5b77fcc3ef24516866561f9b54ac07663ad6 (diff) | |
download | chessh-e05a6d36bb62dae878be254416e7652995e94602.tar.gz chessh-e05a6d36bb62dae878be254416e7652995e94602.zip |
Ensure status is continue before sending notifs
Diffstat (limited to 'lib/chessh/discord')
-rw-r--r-- | lib/chessh/discord/notifier.ex | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chessh/discord/notifier.ex b/lib/chessh/discord/notifier.ex index 09c4ec0..683519e 100644 --- a/lib/chessh/discord/notifier.ex +++ b/lib/chessh/discord/notifier.ex @@ -65,12 +65,13 @@ defmodule Chessh.DiscordNotifier do light_player: %Player{discord_id: light_player_discord_id}, turn: turn, updated_at: last_updated, - moves: move_count + moves: move_count, + status: status } = Repo.preload(game, [:dark_player, :light_player]) delta_t = NaiveDateTime.diff(NaiveDateTime.utc_now(), last_updated, :millisecond) - if delta_t >= min_delta_t do + if delta_t >= min_delta_t && status == :continue do post_discord( discord_game_move_notif_webhook, "<@#{if turn == :light, do: light_player_discord_id, else: dark_player_discord_id}> it is your move in Game #{game_id} (move #{move_count})." |