From e05a6d36bb62dae878be254416e7652995e94602 Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Wed, 1 Feb 2023 16:02:49 -0700 Subject: [PATCH] Ensure status is continue before sending notifs --- lib/chessh/discord/notifier.ex | 5 +++-- 1 file 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})."