From 0c814ceb2da9d1e8ffe49b902c4fbed377038a39 Mon Sep 17 00:00:00 2001 From: Izan Date: Mon, 11 Oct 2021 13:53:29 +0100 Subject: Set `AI.user` to @Sir Lancebot --- bot/exts/fun/tic_tac_toe.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bot') 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: -- cgit v1.2.3