Reputation: 259
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()]}")
Upvotes: 3
Views: 817
Reputation: 2917
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)]}")
Upvotes: 3