aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Kieran Siek <[email protected]>2021-06-07 17:31:49 +0800
committerGravatar GitHub <[email protected]>2021-06-07 17:31:49 +0800
commit0a6a355419d9382b35ac651117287d907e98af0c (patch)
treec468b60cbd00b8f6b00043635dc2d4393a001c4b
parentMerge pull request #758 from OculusMode/master (diff)
parentMerge branch 'main' into fix/ttt (diff)
Merge pull request #595 from Shivansh-007/fix/ttt
Update Tic Tac Toe Command
-rw-r--r--bot/constants.py3
-rw-r--r--bot/exts/evergreen/tic_tac_toe.py14
2 files changed, 12 insertions, 5 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 28103022..f7fe216b 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -216,6 +216,9 @@ class Emojis:
x = "\U0001f1fd"
o = "\U0001f1f4"
+ x_square = "<:x_square:632278427260682281>"
+ o_square = "<:o_square:632278452413661214>"
+
status_online = "<:status_online:470326272351010816>"
status_idle = "<:status_idle:470326266625785866>"
status_dnd = "<:status_dnd:470326272082313216>"
diff --git a/bot/exts/evergreen/tic_tac_toe.py b/bot/exts/evergreen/tic_tac_toe.py
index bd5e0102..48e8e142 100644
--- a/bot/exts/evergreen/tic_tac_toe.py
+++ b/bot/exts/evergreen/tic_tac_toe.py
@@ -79,7 +79,7 @@ class AI:
"""Get move from AI. AI use Minimax strategy."""
possible_moves = [i for i, emoji in board.items() if emoji in list(Emojis.number_emojis.values())]
- for symbol in (Emojis.o, Emojis.x):
+ for symbol in (Emojis.o_square, Emojis.x_square):
for move in possible_moves:
board_copy = board.copy()
board_copy[move] = symbol
@@ -265,12 +265,12 @@ class TicTacToe(Cog):
return
if opponent is None:
game = Game(
- [Player(ctx.author, ctx, Emojis.x), AI(Emojis.o)],
+ [Player(ctx.author, ctx, Emojis.x_square), AI(Emojis.o_square)],
ctx
)
else:
game = Game(
- [Player(ctx.author, ctx, Emojis.x), Player(opponent, ctx, Emojis.o)],
+ [Player(ctx.author, ctx, Emojis.x_square), Player(opponent, ctx, Emojis.o_square)],
ctx
)
self.games.append(game)
@@ -317,8 +317,12 @@ class TicTacToe(Cog):
await ctx.send("Game don't exist.")
return
game = self.games[game_id - 1]
- await ctx.send(f"{game.winner} :trophy: vs {game.loser}")
- await ctx.send(game.format_board())
+
+ embed = discord.Embed(
+ title=f"Match #{game_id} Game Board",
+ description=f"{game.winner} :trophy: vs {game.loser}\n\n{game.format_board()}"
+ )
+ await ctx.send(embed=embed)
def setup(bot: Bot) -> None: