Skip to content

Commit e208b4b

Browse files
authored
Add 'escolher' command for option selection
Added a command to let users choose between options.
1 parent 276060e commit e208b4b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,21 @@ async def tobias_ata(interaction: discord.Interaction):
273273
image = discord.File(f)
274274
await interaction.response.send_message(file=image)
275275

276+
@bot.tree.command(name="escolher", description="Está com dificuldade em escolher coisas? Deixe que eu escolho pra você!")
277+
@app_commands.describe(opcoes="As suas escolhas")
278+
async def escolher(interaction: discord.Interaction, opcoes: str):
279+
280+
opcoes_list = [opcao.strip() for opcao in opcoes.split(',')]
281+
282+
if len(opcoes_list) < 2 or opcoes_list[0] == "":
283+
await interaction.response.send_message(
284+
"❌ Você precisa me dar pelo menos **duas** opções separadas por vírgula!",
285+
ephemeral=True
286+
)
287+
return
288+
289+
escolha = random.choice(opcoes_list)
290+
291+
await interaction.response.send_message(f"😃 Eu escolho `{escolha}`, espero que esteja feliz com o resultado!")
292+
276293
bot.run(TOKEN)

0 commit comments

Comments
 (0)