0

I just created a custom help commands, but i don't understand how can i display the required permissions to run the command and the command cooldown, Tried using this but doesn't work

    async def cmdhelp(self, ctx, command):
        params = []
        for key, value in command.params.items():
            if key not in ("self", "ctx"):
                params.append(f"[{key}]" if "NoneType" in str(value) else f"<{key}>")

        params = " ".join(params)
        embed = discord.Embed(title=f"Help for {command}",
                              colour=ctx.author.colour)
        embed.add_field(name="Description:", value=command.help, inline=False)
        embed.add_field(name="Usage:", value=f"`{command} {params}`", inline=False)
        if not command.aliases:
            embed.add_field(name="Aliases:", value="None", inline=False)
        else:
            embed.add_field(name="Aliases:", value=", ".join(command.aliases))
        embed.add_field(name="Permission Required:", value=f"{command.check}")
        embed.add_field(name="Cooldown:", value=command.cooldown)
        await ctx.send(embed=embed)

I tried to use commands.has_permissions() It gives me this <function check.<locals>.decorator at 0x04FDADA8> So I tried to do this code but it doesn't work

        if commands.has_permissions() == "<function check.<locals>.decorator at 0x04FDABF8>":
            embed.add_field(name="Permission Required:", value=f"None", inline=False)
        else:
            embed.add_field(name="Permission Required:", value=f"Unban", inline=False)
        await ctx.send(embed=embed)
Cedric
  • 142
  • 10
  • See https://stackoverflow.com/questions/59398044/check-if-user-has-permission-in-discord-py It might help you. – FooFooy Aug 24 '20 at 05:59
  • Thats a different things, its a permission required to do the cmds, and what i wanted to do is display the spesific requirements for every cmds on help commands – Cedric Aug 24 '20 at 10:47

1 Answers1

0

I think you may just have to manually assign the perms you need to the command. I've never seen anything like this before :/, sorry I can't help you :<

Daniel Tam
  • 908
  • 1
  • 12
  • 25