I am making a custom help command for my bot and here is my code.
class customhelpcommand(commands.HelpCommand):
def __init__(self):
super().__init__()
async def send_bot_help(self, mapping):
for cog in mapping:
await self.get_destination().send(f"{cog.qualified_name}: {[command.name for command in mapping(cog)]}")
async def send_cog_help(self, cog):
await self.get_destination().send(f"{cog.qualified_name}: {[command.name for command in cog.get_commands()]}")
Some cogs in your mapping might be None. Therefore you can simply check it:
async def send_bot_help(self, mapping):
for cog in mapping:
if cog is not None:
await self.get_destination().send(f"{cog.qualified_name}: {[command.name for command in mapping(cog)]}")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With