aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Izan <[email protected]>2021-10-11 13:53:29 +0100
committerGravatar Izan <[email protected]>2021-10-11 13:56:37 +0100
commit0c814ceb2da9d1e8ffe49b902c4fbed377038a39 (patch)
treeda36f995338f9315df6a8c44a019a1a135646e3b
parentMerge pull request #897 from python-discord/command-prefix-fix (diff)
Set `AI.user` to @Sir Lancebot
-rw-r--r--bot/exts/fun/tic_tac_toe.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/bot/exts/fun/tic_tac_toe.py b/bot/exts/fun/tic_tac_toe.py
index 5c4f8051..49620d02 100644
--- a/bot/exts/fun/tic_tac_toe.py
+++ b/bot/exts/fun/tic_tac_toe.py
@@ -72,7 +72,8 @@ class Player:
class AI:
"""Tic Tac Toe AI class for against computer gaming."""
- def __init__(self, symbol: str):
+ def __init__(self, ctx: Context, symbol: str):
+ self.user = ctx.me
self.symbol = symbol
async def get_move(self, board: dict[int, str], _: discord.Message) -> tuple[bool, int]:
@@ -97,8 +98,8 @@ class AI:
return False, random.choice(open_edges)
def __str__(self) -> str:
- """Return `AI` as user name."""
- return "AI"
+ """Return mention of @Sir Lancebot."""
+ return self.user.mention
class Game:
@@ -265,7 +266,7 @@ class TicTacToe(Cog):
return
if opponent is None:
game = Game(
- [Player(ctx.author, ctx, Emojis.x_square), AI(Emojis.o_square)],
+ [Player(ctx.author, ctx, Emojis.x_square), AI(ctx, Emojis.o_square)],
ctx
)
else: