I want after selecting the first option, for me to have a choice between two other options, like a question within a question. Is it possible to do this? Here is my code:
import discord
from discord.ext import commands
class Dropdown(discord.ui.Select):
def __init__(self):
options = [
discord.SelectOption(label='Акрополь', description='Будет отправлен баннер "Акрополь"', emoji='️'),
discord.SelectOption(label='Год Кролика', description='Будет отправлен баннер "Год Кролика"', emoji=''),
discord.SelectOption(label='Зевс', description='Будет отправлен баннер "Зевс"', emoji='⚡'),
]
super().__init__(placeholder='Выберете ваш любимый цвет...', min_values=1, max_values=1, options=options)
async def callback(self, interaction: discord.Interaction):
if self.values[0] == 'Акрополь':
await interaction.response.send_message('Баннер "Акрополь"',file=discord.File(r'C:\Users\Timir\AppData\Local\Discord\Akropol.png'))
elif self.values[0] == 'Год Кролика':
await interaction.response.send_message('Баннер "Год Кролика"',file=discord.File(r'C:\Users\Timir\AppData\Local\Discord\Kroll.png'))
elif self.values[0] == 'Зевс':
await interaction.response.send_message('Баннер "Зевс"', file=discord.File(r'C:\Users\Timir\AppData\Local\Discord\Zevs.png'))
class DropdownView(discord.ui.View):
def __init__(self):
super().__init__()
self.add_item(Dropdown())
class Bot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
super().__init__(command_prefix=commands.when_mentioned_or('$'), intents=intents)
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='+', intents=intents)
@bot.command()
async def banner(ctx):
"""Отправляет сообщение с выбранным баннером"""
view = DropdownView()
await ctx.send('Выберете нужный баннер:', view=view)
@bot.command()
async def Молодец(ctx):
await ctx.send(f"{ctx.author.mention} молодец")
bot.run('bottoken')
I couldn't find the necessary function and didn't really understand where to use it.