-
Notifications
You must be signed in to change notification settings - Fork 9
Custom Help Command Functionality :DD #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
oohwooh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the title of the embed could be determined from the bots current name rather than hardcoded that would be preferred
src/cogs/help.py
Outdated
| async def help(self, context): | ||
| fields = [[f"All `{cog}` Commands:", "".join([f" • `{cmd}`\n" for cmd in self.client.get_cog(cog).get_commands()]).rstrip()] for cog in self.cogs] | ||
| embed = create_embed( | ||
| "John \"Not a robot\" Peter: Help", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible for this to pull from the bots current name? Sometimes we change the name on occasion (this might get more frequent if #19 merged)
src/cogs/help.py
Outdated
|
|
||
| async def cmd_help(self, client, context, command): | ||
| command = get(self.client.commands, name=command) | ||
| embed = create_embed("John \"Not a robot\" Peter: Help", description=f"Help with the `{command}` command", fields=[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here
src/cogs/help.py
Outdated
| if get(self.client.commands, name=name): | ||
| await self.cmd_help(self.client, context, name) | ||
| else: | ||
| await context.send(embed=create_embed("John \"Not a robot\" Peter: Help", description=f"The command `{name}` does not exist!")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Hmmm I'll try... if not I'll just make it "Help" |
|
Does this work? Again - I can't test it but I think it might work |
|
Testing it, I get the error: |
What line of code did you get that from? the error should repeat twice... can you send me the first part of it? |
|
Also, I think it might be because all the commands don't have a brief or description, let me try to fix that |
|
Here's the full sterr: |
|
Does this help? |
|
It appears to work! Also, the Also, just as an aside, I was poking around docs and found this: https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#help-commands, which might be a better way of implementing this functionality (although I'm totally fine merging this code, just something i thought worth sharing) |
I used to have an old help command using BotHelpCommand, which I later threw away since I couldn't find a way to put the help command itself in a category... it would say |
|
Looks good to merge! I'm getting an error in testing with the |

Note: I didn't create a new application and use it to test the code out, but it's the same code from my other bots, just modified a small bit. If you have some way of testing it out, please do before "publishing" it. 🙂