Skip to content

Fix AttributeErrors in tic-tac-toe command#899

Merged
HassanAbouelela merged 4 commits into
mainfrom
fix-issue-898
Oct 17, 2021
Merged

Fix AttributeErrors in tic-tac-toe command#899
HassanAbouelela merged 4 commits into
mainfrom
fix-issue-898

Conversation

@TizzySaurus
Copy link
Copy Markdown
Contributor

@TizzySaurus TizzySaurus commented Oct 11, 2021

Relevant Issues

Closes #898.
Closes #772.

Description

  • Resolved the AI.user AttributeError by setting it to the bot (ctx.me)
  • Resolved the Game.channel AttributeError by setting it to ctx.channel.

Did you:

@TizzySaurus TizzySaurus changed the title Set AI.user to @Python Set AI.user to @Sir Lancebot Oct 11, 2021
@TizzySaurus TizzySaurus changed the title Set AI.user to @Sir Lancebot Fix AttributeErrors in tic-tac-toe command Oct 11, 2021
@Xithrius Xithrius added area: backend Related to internal functionality and utilities category: fun Related to fun and games type: bug Something isn't working labels Oct 12, 2021
@Xithrius
Copy link
Copy Markdown
Contributor

image

This is the error that occurs now when two users try to play against AI, one after the other, while one game is still in progress. Is this the desired output?

@TizzySaurus
Copy link
Copy Markdown
Contributor Author

TizzySaurus commented Oct 12, 2021

image

This is the error that occurs now when two users try to play against AI, one after the other, while one game is still in progress. Is this the desired output?

The code from before this PR made it so that there can only even be one command per channel (is_channel_free), and the user invoking the command cannot already be playing a game (is_requester_free).

I guess the missing attributes, fixed with this PR, prevented the checks from actually working, which is why the error only now shows.

TL;DR; This is the behaviour the original author intended, but if we want it changed I can do so -- I guess at a minimum we should improve the error message.

@TizzySaurus TizzySaurus added the status: needs review Author is waiting for someone to review and approve label Oct 14, 2021
Copy link
Copy Markdown
Contributor

@Shivansh-007 Shivansh-007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :shipit:

Comment thread bot/exts/fun/tic_tac_toe.py Outdated
@HassanAbouelela HassanAbouelela merged commit 559e76f into main Oct 17, 2021
@HassanAbouelela HassanAbouelela deleted the fix-issue-898 branch October 17, 2021 12:17
@Xithrius Xithrius removed the status: needs review Author is waiting for someone to review and approve label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backend Related to internal functionality and utilities category: fun Related to fun and games type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'AI' object has no attribute 'user' Handle the AI in Tic-Tac-Toe requester check.

5 participants