0
votes

I am trying to create a "help" command for my bot, just like the MEE6 author/s did: [MEE6][1] [1]: https://i.stack.imgur.com/Nyehz.png

Here's my code:

admin = discord.Embed(title='yBot  |  ADMIN', description='help', color=0x004768)
admin.add_field(name="gruby jestes",value='tak')

MainHelpPage = discord.Embed(title='yBot  |  HELP', description='help', color=0x004768)
MainHelpPage.add_field(name="Komendy Administracji", value='`.help admin`')
MainHelpPage.set_footer(text="© 2020 - Powered by yanuu ;k#2137")

[...]
bot.remove_command("help")

@bot.command(pass_context=True)
async def help(ctx, *, page=MainHelpPage):

        await ctx.send(embed=page)

Sending the Main Page works completely fine, but when I want to receive the 'admin' embed, I'm getting this error:

Traceback (most recent call last):
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\client.py", line 333, in _run_event
    await coro(*args, **kwargs)
  File "D:\..python\diskord\discord-test.py", line 97, in on_command_error
    raise error
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 851, in invoke
    await self.prepare(ctx)
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 786, in prepare
    await self._parse_arguments(ctx)
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 706, in _parse_arguments
    kwargs[name] = await self.transform(ctx, param)
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 552, in transform
    return await self.do_conversion(ctx, converter, argument, param)
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 505, in do_conversion
    return await self._actual_conversion(ctx, converter, argument, param)
  File "C:\Users\<--->\AppData\Roaming\Python\Python38\site-packages\discord\ext\commands\core.py", line 476, in _actual_conversion
    raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "Embed" failed for parameter "page".

Any ideas on how to fix it?

1

1 Answers

0
votes

You should make the embeds inside the help command itself like this.


@bot.command(pass_context=True)
async def help(ctx, menu_type: str = None):
    if menu_type == 'Music':
        embed = discord.Embed(title="Music", description="Something", color=0x00ff00)
    elif menu_type == "Admin":
        embed = discord.Embed(title="Admin", description="Something", color=0x00ff00)
    else:
        embed = discord.Embed(title="Main", description="Something", color=0x00ff00)

    await ctx.send(embed=embed)