我试图制作一条类似于气球消息的消息,但我不知道如何使其发挥作用我并不担心如何使其发挥作用,我只是想让它发挥作用。感谢谁尝试做到这一点。
我尝试用枕头制作气球,但我无法使用它,因为它说枕头不可用或其他什么。
@bot.command(name='balloon')
async def create_balloon(ctx, color, *, text): color = color.lower() # 转换为较小的保证一致
# Verifique se a cor fornecida é válida
allowed_colors = ['red', 'blue', 'green', 'yellow', 'purple', 'orange', 'pink']
if color not in allowed_colors:
await ctx.send("Cor inválida. Escolha entre: red, blue, green, yellow, purple, orange, pink.")
return
# Crie a mensagem com o balão de conversa formatado
balloon_message = f"```{color}\n{text}\n```"
await ctx.send(balloon_message)
我想这就是你想要的
options = ['red', 'blue', 'yellow'] #add other colors in list
@client.tree.command(name="ballon", description="your description")
async def ballon(interaction: discord.Interaction, color: str):
if color == 'red':
embed = discord.Embed(title="Red Ballon", color=discord.Colour.red())
embed.description = "you have chosen the red ballon!"
elif color == 'blue':
embed = discord.Embed(title="Blue Ballon", color=discord.Colour.blue())
embed.description = "you have chosen the blue ballon!"
elif color == 'yellow':
embed = discord.Embed(title="Yellow Ballon", color=discord.Colour.yellow())
embed.description = "you have chosen the yellow ballon!"
else:
embed = discord.Embed(title="Error", color=discord.Colour.red())
embed.description = "please select one of the following colors: 'blue', 'red', 'yellow'"
await interaction.response.send_message(embed=embed)