fix invalid codeFri, 23 Jun 2023

@bot.command() async def embed(ctx): # Define the options for color selection color_options = [ nextcord.SelectOption(label='Red', value='ff0000'), nextcord.SelectOption(label='Green', value='00ff00'), nextcord.SelectOption(label='Blue', value='0000ff') ] # Create the initial embed object embed = nextcord.Embed() # Define the callback function for the submit button async def create_embed(interaction): # Get the selected values from the interaction title =['values']['title'] description =['values']['description'] color =['values']['color'] # Update the embed with the selected values embed.title = title embed.description = description embed.color = int(color, 16) # Send the embed to the channel await ctx.send(embed=embed) # Create the view with components view = nextcord.ui.View() view.add_item(nextcord.ui.Select( options=color_options, placeholder='Select color', custom_id='color', min_values=1, max_values=1 )) view.add_item(nextcord.ui.TextInput( placeholder='Enter title', custom_id='title', label='Title' )) view.add_item(nextcord.ui.TextInput( placeholder='Enter description', custom_id='description', label='Description' )) view.add_item(nextcord.ui.Button( style=nextcord.ButtonStyle.primary, label='Create Embed', custom_id='create_embed', emoji='✅' )) # Send the view to the channel message = await ctx.send('Create Embed:', view=view) # Wait for the user interaction interaction = await bot.wait_for( 'component_interaction', check=lambda i: == and == ) # Call the callback function for the submit button await create_embed(interaction)

Questions about programming?Chat with your personal AI assistant