aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-04-09 19:39:07 +0300
committerGravatar ks129 <[email protected]>2020-04-09 19:39:07 +0300
commit14e5cadcbd8344cdba0b410567525f7518ac0a7a (patch)
treefbe37fa6bc63529ab3eaf997995ce1af4df30fc6
parent(TicTacToe): Added way to send board to custom channel in `Game.send_board`. (diff)
(TicTacToe): Created command to show game information `tictactoe history show <game_id>`.
-rw-r--r--bot/exts/evergreen/tic_tac_toe.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/bot/exts/evergreen/tic_tac_toe.py b/bot/exts/evergreen/tic_tac_toe.py
index 87a845f1..a9971ad2 100644
--- a/bot/exts/evergreen/tic_tac_toe.py
+++ b/bot/exts/evergreen/tic_tac_toe.py
@@ -253,6 +253,16 @@ class TicTacToe(Cog):
discord.Embed(title="Most recent Tic Tac Toe games")
)
+ @tic_tac_toe_logs.command(name="show", aliases=("s",))
+ async def show_tic_tac_toe_board(self, ctx: Context, game_id: int) -> None:
+ """View game board by ID (ID is possible to get by `.tictactoe history`)."""
+ if len(self.games) < game_id:
+ await ctx.send("Game don't exist.")
+ return
+ game = self.games[game_id - 1]
+ await ctx.send(f"{game.winner.user} :trophy: vs {game.loser.user}")
+ await game.send_board(ctx.channel)
+
def setup(bot: SeasonalBot) -> None:
"""Load TicTacToe Cog."""