diff options
author | Simponic <loganhunt@simponic.xyz> | 2023-02-01 22:55:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-01 22:55:06 -0700 |
commit | 47d3f28f16bdd1eb7ad99b91f7963fd2c4b8f9bf (patch) | |
tree | 2682c4ee63fcf67db688bf61077419f521932012 /lib/chessh/ssh/client/game/game.ex | |
parent | a26256700d93392dfc92bfc6dc6842dac842cc15 (diff) | |
download | chessh-47d3f28f16bdd1eb7ad99b91f7963fd2c4b8f9bf.tar.gz chessh-47d3f28f16bdd1eb7ad99b91f7963fd2c4b8f9bf.zip |
Discord threads (#16)
* Add initial support for discord threads
* Finish thread creation
Diffstat (limited to 'lib/chessh/ssh/client/game/game.ex')
-rw-r--r-- | lib/chessh/ssh/client/game/game.ex | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/chessh/ssh/client/game/game.ex b/lib/chessh/ssh/client/game/game.ex index d6b0b5b..6b2ef60 100644 --- a/lib/chessh/ssh/client/game/game.ex +++ b/lib/chessh/ssh/client/game/game.ex @@ -396,7 +396,7 @@ defmodule Chessh.SSH.Client.Game do {:ok, status} -> {:ok, fen} = :binbo.get_fen(binbo_pid) - {:ok, _new_game} = + {:ok, %Game{status: after_move_status}} = game |> Game.changeset( Map.merge( @@ -413,11 +413,18 @@ defmodule Chessh.SSH.Client.Game do :syn.publish(:games, {:game, game_id}, {:new_move, attempted_move}) - GenServer.cast( - :discord_notifier, - {:schedule_notification, {:move_reminder, game_id}, - Application.get_env(:chessh, DiscordNotifications)[:game_move_notif_delay_ms]} - ) + if after_move_status == :continue do + GenServer.cast( + :discord_notifier, + {:schedule_notification, {:move_reminder, game_id}, + Application.get_env(:chessh, DiscordNotifications)[:game_move_notif_delay_ms]} + ) + else + GenServer.cast( + :discord_notifier, + {:schedule_notification, {:cleanup_thread, game_id}, 0} + ) + end _ -> nil |