#Buttons and dropdown in same message

1 messages · Page 1 of 1 (latest)

sacred totem
#

so i want button and dropdown in same emssage heres what i tried ```py
class DropdownView(discord.ui.View):
def init(self):
super().init()
self.add_item(Dropdown())
self.add_item(Confirm())

class Confirm(discord.ui.Button):
def init(self):
super().init()
self.value = None
@discord.ui.button(label="Join event", style=discord.ButtonStyle.green, disabled=False)
async def callback(self, interaction: discord.Interaction):
print('uh')

class Dropdown(discord.ui.Select):
def init(self):
options = [
discord.SelectOption(label="Red", value='red', description="Your prefered team is red", emoji="🟥"),
# discord.SelectOption(label="Green", value='' description="Your favourite colour is green", emoji="🟩"),
discord.SelectOption(label="Blue", value='blue', description="Your prefered team is blue", emoji="🟦"),
]
super().init(
placeholder="Choose your prefered team color",
min_values=1,
max_values=1,
options=options,
)
async def callback(self, interaction: discord.Interaction):
await interaction.response.send_message(f'you chose somthing {self.values[0]}')

sending message
view = DropdownView()

    await interaction.response.send_message(embed=embed, view=view)
#
Traceback (most recent call last):
  File "/home/david/Documents/GitHub/creator-lazer-tag/venv/lib/python3.10/site-packages/discord/ui/modal.py", line 324, in dispatch
    await value.callback(interaction)
  File "/home/david/Documents/GitHub/creator-lazer-tag/cogs/views.py", line 85, in callback
    await interaction.response.send_message(embed=embed, view=view)
  File "/home/david/Documents/GitHub/creator-lazer-tag/venv/lib/python3.10/site-packages/discord/interactions.py", line 712, in send_message
    await self._locked_response(
  File "/home/david/Documents/GitHub/creator-lazer-tag/venv/lib/python3.10/site-packages/discord/interactions.py", line 959, in _locked_response
    await coro
  File "/home/david/Documents/GitHub/creator-lazer-tag/venv/lib/python3.10/site-packages/discord/webhook/async_.py", line 213, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.1.components.0.label: This field is required```
sacred totem
#

Still need help

vocal gorge
#

Look at the error

#

Value at green

sacred totem
#

I read it but I can't figure out what's wrong

fathom wigeon
sacred totem
#

thats how docs put it

#

iirc

proper abyss
sacred totem
#

i just copied the code from another button i have in bot that works

#

but i can change ig