Discord.py 如何对特定的“问题”给出不同的答案;arg";不和谐

Discord.py 如何对特定的“问题”给出不同的答案;arg";不和谐,discord.py,Discord.py,因此,我想要的是一个能同时响应+命令和+命令2两个命令的@bot.command()。因此,如果我说+commands,它会用第一个命令列表进行回复,如果我说+commands 2,它会用第二个命令列表进行回复 到目前为止,我所拥有的: @bot.command() async def commands(ctx): embed=discord.Embed(title="**__Commands 1:__**", description="Here the M

因此,我想要的是一个能同时响应
+命令
+命令2
两个命令的
@bot.command()
。因此,如果我说
+commands
,它会用第一个命令列表进行回复,如果我说
+commands 2
,它会用第二个命令列表进行回复

到目前为止,我所拥有的:

@bot.command()
async def commands(ctx):
    embed=discord.Embed(title="**__Commands 1:__**", description="Here the Moderation and Regular commands of this bot, the requirements to use them and their nicknames.\n", color=discord.Color.blue())

    embed.add_field(name="**Moderation Commands**", value="`+lock`: Prevents all non-admins from speaking in the channel.\n**Permissions Required**: Role With Manage Channel Permissions\n\n`+unlock`: Allows all non-admins to talk in the channel again.\n**Permissions Required**: Role With Manage Channel Permissions\n\n`+kick`: Kicks the person that you ping after the command `+kick`.\n**Permissions Required**: Role with kick members permissions required.\n\n`+ban`: Bans the person that you ping after the command `+kick`.\n**Permissions Required**: Role with ban members permissions required.\n", inline=False)

    embed.add_field(name='**Regular Commands**', value='`+announcement`: Sends an announcement to the announcement channel.\n**Permissions Required**: Role With Kick Abilities\n**Nicknames**: `+ann`\n\n`+members`: Shows how many people and bots are on the server and their stats.\n**Nicknames**: `+m`\n\n**The permissions requirements assumes that your admins and moderators are trusted people.*', inline=False)
    
    await ctx.send(embed=embed)

@bot.command()
async def commands2(ctx):
    embed=discord.Embed(title="**__Commands 2:__**", description="Here the fun commands of this bot, the requirements to use them and their nicknames.\n", color=discord.Color.blue())

    embed.add_field(name='**Fun Commands**', value='`+spam`: Sends a spam message.\n**Permissions Required**: Role With Kick Abilities\n\n`+say`: Makes the bot say the words you said after `+say`.\n**Nicknames**: `+s`\n\n`+bold`: Makes the bot say the words you said after `+bold` in bold.\n**Nicknames**: `+b`\n\n`+italic`: Makes the bot say the words you said after `+italic` in italics.\n**Nicknames**: `+i`\n\n`+strikethrough`: Makes the bot say the words you said after `+strikethrough` crossed out.\n**Nicknames**: `+st`\n\n`+underline`: Makes the bot say the words you said after `+underline` underlined.\n**Nicknames**: `+ul`\n\n`+boldunderline`: Makes the bot say the words you said after `boldunderline` bolded and underlined.\n**Nicknames**: `+bul`\n\n`+bully`: The bot bullies the person you __ping__ after the command `+bully`.\n\n**The permissions requirements assumes that your admins and moderators are trusted people.*', inline=False)

    await ctx.send(embed=embed)
我以前在什么地方见过,我记不起来了,比如:

@bot.command()
async def commands(ctx, arg):
if {arg} == 2:
    embed=discord.Embed(title="**__Commands 2:__**", description="Here the fun commands of this bot, the requirements to use them and their nicknames.\n", color=discord.Color.blue())

    embed.add_field(name='**Fun Commands**', value='`+spam`: Sends a spam message.\n**Permissions Required**: Role With Kick Abilities\n\n`+say`: Makes the bot say the words you said after `+say`.\n**Nicknames**: `+s`\n\n`+bold`: Makes the bot say the words you said after `+bold` in bold.\n**Nicknames**: `+b`\n\n`+italic`: Makes the bot say the words you said after `+italic` in italics.\n**Nicknames**: `+i`\n\n`+strikethrough`: Makes the bot say the words you said after `+strikethrough` crossed out.\n**Nicknames**: `+st`\n\n`+underline`: Makes the bot say the words you said after `+underline` underlined.\n**Nicknames**: `+ul`\n\n`+boldunderline`: Makes the bot say the words you said after `boldunderline` bolded and underlined.\n**Nicknames**: `+bul`\n\n`+bully`: The bot bullies the person you __ping__ after the command `+bully`.\n\n**The permissions requirements assumes that your admins and moderators are trusted people.*', inline=False)

    await ctx.send(embed=embed)

不过,这肯定行不通(我试过了),您能告诉我需要做什么吗?

您只需在命令函数中添加一个参数,然后使用if-else

@bot.command()
async def commands(ctx, command_number):
    if int(command_number) == 1:
        embed=discord.Embed(title="**__Commands 1:__**", description="Here the Moderation and Regular commands of this bot, the requirements to use them and their nicknames.\n", color=discord.Color.blue())

        embed.add_field(name="**Moderation Commands**", value="`+lock`: Prevents all non-admins from speaking in the channel.\n**Permissions Required**: Role With Manage Channel Permissions\n\n`+unlock`: Allows all non-admins to talk in the channel again.\n**Permissions Required**: Role With Manage Channel Permissions\n\n`+kick`: Kicks the person that you ping after the command `+kick`.\n**Permissions Required**: Role with kick members permissions required.\n\n`+ban`: Bans the person that you ping after the command `+kick`.\n**Permissions Required**: Role with ban members permissions required.\n", inline=False)

        embed.add_field(name='**Regular Commands**', value='`+announcement`: Sends an announcement to the announcement channel.\n**Permissions Required**: Role With Kick Abilities\n**Nicknames**: `+ann`\n\n`+members`: Shows how many people and bots are on the server and their stats.\n**Nicknames**: `+m`\n\n**The permissions requirements assumes that your admins and moderators are trusted people.*', inline=False)
    
        await ctx.send(embed=embed)

    elif int(command_number) == 1:
        embed=discord.Embed(title="**__Commands 2:__**", description="Here the fun commands of this bot, the requirements to use them and their nicknames.\n", color=discord.Color.blue())

        embed.add_field(name='**Fun Commands**', value='`+spam`: Sends a spam message.\n**Permissions Required**: Role With Kick Abilities\n\n`+say`: Makes the bot say the words you said after `+say`.\n**Nicknames**: `+s`\n\n`+bold`: Makes the bot say the words you said after `+bold` in bold.\n**Nicknames**: `+b`\n\n`+italic`: Makes the bot say the words you said after `+italic` in italics.\n**Nicknames**: `+i`\n\n`+strikethrough`: Makes the bot say the words you said after `+strikethrough` crossed out.\n**Nicknames**: `+st`\n\n`+underline`: Makes the bot say the words you said after `+underline` underlined.\n**Nicknames**: `+ul`\n\n`+boldunderline`: Makes the bot say the words you said after `boldunderline` bolded and underlined.\n**Nicknames**: `+bul`\n\n`+bully`: The bot bullies the person you __ping__ after the command `+bully`.\n\n**The permissions requirements assumes that your admins and moderators are trusted people.*', inline=False)

        await ctx.send(embed=embed)

    else:
        await ctx.send('Please choose: 1 or 2')