How to insert discord.py command into discord command

Haley

https://i.stack.imgur.com/VNWoG.png

I want to use the help like the screenshot above, but I don't know how to write the discord.py code I used a translator

Shunya

What you are looking at is a customized discord-like chat from Xenon. This chat allows you to Discord-like chat section, but emulates the behaviour of Discord. Xenon is open source, so just check their repositories if you want to do the same as they do.

If you want to customize the help command of your bot, which all bots have, you can do it with the recent changes of discord.py-rewrite. Toa chieve what you want you will need to subclass HelpCommand or MinimalHelpCommand, then pass it to bot.help_command.

The following code shows the standard way of subclassing MinimalHelpCommand:

class MyHelpCommand(commands.MinimalHelpCommand):
    def get_command_signature(self, command):
        return '{0.clean_prefix}{1.qualified_name} {1.signature}'.format(self, command)

class MyCog(commands.Cog):
    def __init__(self, bot):
        self._original_help_command = bot.help_command
        bot.help_command = MyHelpCommand()
        bot.help_command.cog = self

    def cog_unload(self):
        self.bot.help_command = self._original_help_command

For more info, discord.py documentation: https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#help-commands

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related