Ensure status is continue before sending notifs

This commit is contained in:
Logan Hunt 2023-02-01 16:02:49 -07:00
parent fe5f5b77fc
commit e05a6d36bb
No known key found for this signature in database
GPG Key ID: 8AC6A4B840C0EC49

View File

@ -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})."