Feat/wit 132 Implement guessing functionality#54
Feat/wit 132 Implement guessing functionality#54ledanielhuynh wants to merge 10 commits intomainfrom
Conversation
katejoh
left a comment
There was a problem hiding this comment.
Hi Daniel, looks great so far! I've suggested a few minor style changes and bugfixes as I found some errors while testing. Let me know if you have any questions!
| elif eval(current_input_math) != 24: | ||
| await self.update_message_incorrect( | ||
| interaction, "Sorry, that's not 24!" | ||
| ) |
There was a problem hiding this comment.
Add a condition and message for if the user enters an input that causes an error when evaluated (e.g. they only input an open parenthesis, only have two numbers without any operators, click equals without having inputted anything, etc.), as this currently causes an error and a 'This interaction failed' message.
cogs/24.py
Outdated
| embed = discord.Embed(title="24", color=discord.Color.orange()) | ||
|
|
||
| embed.add_field( | ||
| name="Your numbers are:", | ||
| value=f"` {self.numbers[0]} {self.numbers[1]} {self.numbers[2]} {self.numbers[3]} `", | ||
| inline=False, | ||
| ) | ||
|
|
||
| embed.add_field( | ||
| name="Input:", value="`" + self.current_input + "`", inline=False | ||
| ) |
There was a problem hiding this comment.
Move this repeated code into a function which returns the embed. You can call this function at the start of each update_message function (might have to pass in the colour), then add the unique fields + respond to the interaction afterwards!
| # if button_id in self.numbers: | ||
| # item.disabled = True | ||
|
|
||
| await self.update_message(interaction) |
There was a problem hiding this comment.
Co-authored-by: katejoh <101443389+katejoh@users.noreply.github.com>
Co-authored-by: katejoh <101443389+katejoh@users.noreply.github.com>

No description provided.