Skip to content

Commit

Permalink
Merge pull request #248 from FirePlank/dev
Browse files Browse the repository at this point in the history
Fixed a few issues with the new poll command
  • Loading branch information
HETHAT authored Nov 2, 2023
2 parents e06b2fa + a1d99f6 commit ac328ca
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 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,8 +109,9 @@ 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)
message = await interaction.original_response()
await interaction.response.defer()
await interaction.delete_original_response()
message = await interaction.channel.send(embed=embed)

for i in range(0, len(embed.fields)):
await message.add_reaction(emojis[i])

0 comments on commit ac328ca

Please sign in to comment.