尝试让 Discord 机器人在命令后做出响应

时间:2021-07-04 14:38:11

标签: python discord discord.py bots

我想这样创建,每当您使用 .choose 和之后的类时,因此无论是小偷、雇佣兵、黑客还是工程师,都可以更改用户的类,但是无论何时我尝试它都行不通。它总是最终重新发送 .choose 命令,如下所示。我该如何编辑它,而不是重新发送 .choose 命令,它实际上会更改用户类并回复 "您选择了选定的等级。"

@client.command(aliases = ['Classes'])
async def classes(ctx):
  SelectEmbed = discord.Embed(
    Title = "Class list!",
    colour = discord.Colour.dark_grey()
)
  SelectEmbed.add_field(name = "Available Classes", value = "Mercenary, Hacker, Engineer and Thief.", inline = True)
  await ctx.send(embed=SelectEmbed)

@client.command(aliases = ['Choose','ChoOse'])
async def choose(ctx):
  SelectClass = discord.Embed(
    TItle = "Choose your class!",
    colour = discord.Colour.dark_grey()
  )
  SelectClass.add_field(name = "Select your class below.",value = "Choose a class: use the '.classes' command to view the class list.", inline = True)
  await ctx.send(embed = SelectClass)

1 个答案:

答案 0 :(得分:0)

也许这对你有帮助

@client.command(aliases = ['Classes'])
async def classes(ctx):
  SelectEmbed = discord.Embed(
    Title = "Class list!",
    colour = discord.Colour.dark_grey()
  )
  SelectEmbed.add_field(name = "Available Classes", value = "Mercenary, Hacker, Engineer and Thief.", inline = True)
  await ctx.send(embed=SelectEmbed)

@client.command(aliases = ['Choose','ChoOse'])
async def choose(ctx, name):
  SelectClass = discord.Embed(
    TItle = "Choose your class!",
    colour = discord.Colour.dark_grey()
  )
  SelectClass.add_field(name = "Select your class below.",value = "Choose a class: use the '.classes' command to view the class list.", inline = True)
  await ctx.send(embed = SelectClass)
  await ctx.send(f"You have selected {str(name)}!")