diff --git a/README.md b/README.md index a22b7ef..636ac77 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ looking for opponents, or in games when it is one's turn. https://user-images.githubusercontent.com/25559600/221317658-a80046ca-6009-456d-b43c-67d95baa4bf6.mp4 +## Bots +As a user, you can create 2 bot accounts at [/bots](https://chessh.linux.usu.edu/bots). These are driven by +webhooks. + +For an example bot, see [chessh example bot](https://github.com/Simponic/chessh_bot). + ## Usage ### Dependencies diff --git a/config/config.exs b/config/config.exs index aa2f7b1..33f88cb 100644 --- a/config/config.exs +++ b/config/config.exs @@ -19,7 +19,7 @@ config :chessh, RateLimits, discord_notification_rate: 30, discord_notification_rate_ms: 1000, bot_redrive_rate: 1, - bot_redrive_rate_ms: 60_000 + bot_redrive_rate_ms: 30_000 config :chessh, Web, discord_oauth_login_url: "https://discord.com/api/oauth2/token", diff --git a/lib/chessh/schema/bot.ex b/lib/chessh/schema/bot.ex index 6a6d15b..9a86d69 100644 --- a/lib/chessh/schema/bot.ex +++ b/lib/chessh/schema/bot.ex @@ -37,7 +37,6 @@ defmodule Chessh.Bot do bot: %Chessh.Bot{id: bot_id, name: bot_name}, fen: fen, turn: turn, - last_move: last_move, status: status, light_player_id: light_player_id, dark_player_id: dark_player_id @@ -50,7 +49,6 @@ defmodule Chessh.Bot do turn: Atom.to_string(turn), bot_turn: (is_nil(light_player_id) && turn == :light) || (is_nil(dark_player_id) && turn == :dark), - last_move: last_move, status: Atom.to_string(status) } end diff --git a/lib/chessh/ssh/client/game/renderer.ex b/lib/chessh/ssh/client/game/renderer.ex index cffc838..ecd1803 100644 --- a/lib/chessh/ssh/client/game/renderer.ex +++ b/lib/chessh/ssh/client/game/renderer.ex @@ -10,10 +10,11 @@ defmodule Chessh.SSH.Client.Game.Renderer do @tile_width 7 @tile_height 4 - @previous_move_background ANSI.light_magenta_background() - @from_select_background ANSI.light_green_background() - @to_select_background ANSI.light_yellow_background() - @in_check_color ANSI.yellow_background() + @previous_move_background ANSI.color_background(208) + @from_select_background ANSI.color_background(105) + + @to_select_background ANSI.color_background(177) + @in_check_color ANSI.color_background(197) @dark_piece_color ANSI.red() @light_piece_color ANSI.light_cyan() diff --git a/lib/chessh/ssh/client/menus/select_bot.ex b/lib/chessh/ssh/client/menus/select_bot.ex index f31f65a..86fc7cd 100644 --- a/lib/chessh/ssh/client/menus/select_bot.ex +++ b/lib/chessh/ssh/client/menus/select_bot.ex @@ -106,6 +106,8 @@ defmodule Chessh.SSH.Client.SelectBot do ) |> Repo.insert() + spawn(fn -> Bot.send_update(game |> Repo.preload([:bot])) end) + {Chessh.SSH.Client.Game, %Chessh.SSH.Client.Game.State{player_session: player_session, color: color, game: game}}