summaryrefslogtreecommitdiff
path: root/lib/chessh/ssh/client
diff options
context:
space:
mode:
authorLizzy Hunt <elizabeth.hunt@simponic.xyz>2023-05-06 10:52:20 -0700
committerLizzy Hunt <elizabeth.hunt@simponic.xyz>2023-05-06 10:53:09 -0700
commited0de7e81feb0981a381ec95272ee0a0278acebd (patch)
tree3bcb1d2db7da39a61ab00141890e098d2bee4fc6 /lib/chessh/ssh/client
parentf5773f606a738e092845597f2af77e9602b06552 (diff)
downloadchessh-ed0de7e81feb0981a381ec95272ee0a0278acebd.tar.gz
chessh-ed0de7e81feb0981a381ec95272ee0a0278acebd.zip
send notification only from process where player joined and when discord thread id hasn't been created, set prod log level to info for better debugging
Diffstat (limited to 'lib/chessh/ssh/client')
-rw-r--r--lib/chessh/ssh/client/game/game.ex12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/chessh/ssh/client/game/game.ex b/lib/chessh/ssh/client/game/game.ex
index 4ac0f31..4fb28f3 100644
--- a/lib/chessh/ssh/client/game/game.ex
+++ b/lib/chessh/ssh/client/game/game.ex
@@ -155,6 +155,12 @@ defmodule Chessh.SSH.Client.Game do
if status == :ok && maybe_joined_game do
:syn.publish(:games, {:game, game_id}, :player_joined)
+
+ GenServer.cast(
+ :discord_notifier,
+ {:schedule_notification, {:player_joined, game_id},
+ Application.get_env(:chessh, DiscordNotifications)[:game_player_joined_notif_delay_ms]}
+ )
end
binbo_pid = initialize_game(game_id, fen)
@@ -212,12 +218,6 @@ defmodule Chessh.SSH.Client.Game do
:player_joined,
%State{client_pid: client_pid, game: %Game{id: game_id}} = state
) do
- GenServer.cast(
- :discord_notifier,
- {:schedule_notification, {:player_joined, game_id},
- Application.get_env(:chessh, DiscordNotifications)[:game_player_joined_notif_delay_ms]}
- )
-
game = Repo.get(Game, game_id) |> Repo.preload([:light_player, :dark_player])
new_state = %State{state | game: game}
send(client_pid, {:send_to_ssh, Renderer.render_board_state(new_state)})