qhip
qhip

Reputation: 31

How do I activate a command inside a command (discord.py)

What im trying to do is to make the bot respond when to a command when its under the "help" command list

 @bot.command(pass_context = True)
    async def help(ctx):
        a_embed1 = discord.Embed(title="Vibe's Command List")
        a_embed1.add_field(name=':smile: Fun', value="`vb help fun`", inline=True)
        await ctx.send(embed=a_embed1)

Like when I type "prefix_here help economy", then the economy embed list will be sent rather than the help embed list. Any help would be much appreciated!

Upvotes: 0

Views: 159

Answers (1)

Just for fun
Just for fun

Reputation: 4225

Add an argument and default it to None then check if it's not None then send the common help command else use if-elifs to check what it is equal to and send its help

@bot.command()
async def help(ctx, c=None):
    if not c: # normal help command
        a_embed1 = discord.Embed(title="Vibe's Command List")
        a_embed1.add_field(name=':smile: Fun', value="`vb help fun`", inline=True)
        await ctx.send(embed=a_embed1)
    elif c.lower() == "economy":
        # define embed and send
    # multiple elifs for other commands

Upvotes: 1

Related Questions