Skip to content

Instantly share code, notes, and snippets.

@Gobot1234
Created December 13, 2019 21:16
Show Gist options
  • Save Gobot1234/0efc68f3be4bf821ef5d529f47901bc8 to your computer and use it in GitHub Desktop.
Save Gobot1234/0efc68f3be4bf821ef5d529f47901bc8 to your computer and use it in GitHub Desktop.

Subclassing the help command in discord.py

This is going to be a short-ish guide on sub-classing help as ?tag new help isn't great at explaining things

Choosing which help command to subclass

  1. Don't subclass HelpCommand unless you're going to override every one of the send_x methods, because that class does not do anything (it literally just returns None)
  2. DefaultHelpCommand is for the default help command (the code block one) Example of the default help command class
  3. MinimalHelpCommandis a minimalistic version of the help command, this is an example of the command produced if you copy ?tag new helpExample of the minimal help command class
  4. HelpCommand is a completely blank slate and can be subclassed to look any way you want, although most people use them for embeds My example of a help command Melody's help command

Getting started

The first thing you need with any subclassed help command is an __init__. For the main examples I will use the HelpCommand class as it is the one I am most familiar with.

class HelpCommand(commands.HelpCommand):
	def __init__(self):
		super().__init__(command_attrs={
		'help': 'Shows help about the bot, a command, or a category'  # This is the command.help string
		'cooldown': commands.Cooldown(1, 3.0, commands.BucketType.member),  # these are custom attributes passed to the help command
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment