Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FirePlank committed Nov 2, 2023
1 parent a70c7df commit e001d43
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bot/extensions/polls/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ async def callback(self, interaction: core.InteractionType):
if len(embed.fields) >= 1:
self.view.add_item(DeletePollOptions(embed.fields))

# We removed a choice so there gotta be some space for more
field_count = len(embed.fields)

# We removed a choice so reset the disabled state of the buttons
add_choice_btn = discord.utils.get(self.view.children, custom_id=CreatePollView.ADD_CUSTOM_ID)
create_poll_btn = discord.utils.get(self.view.children, custom_id=CreatePollView.CREATE_CUSTOM_ID)
add_choice_btn.disabled = False
create_poll_btn.disabled = field_count < 2

await interaction.response.edit_message(embed=embed, view=self.view)

Expand Down Expand Up @@ -105,7 +109,7 @@ async def create_poll(self, interaction: core.InteractionType, _button: ui.Butto
"You can't create a poll with less than 2 choices", ephemeral=True
)

await interaction.response.send_message(embed=embed)
await interaction.channel.send(embed=embed)
message = await interaction.original_response()

for i in range(0, len(embed.fields)):
Expand Down

0 comments on commit e001d43

Please sign in to comment.