Skip to content

change ctx.send_help to ctx.invoke(help_command)#625

Merged
ks129 merged 5 commits into
python-discord:masterfrom
ToxicKidz:no-ctx-send-help
Mar 13, 2021
Merged

change ctx.send_help to ctx.invoke(help_command)#625
ks129 merged 5 commits into
python-discord:masterfrom
ToxicKidz:no-ctx-send-help

Conversation

@ToxicKidz
Copy link
Copy Markdown
Contributor

@ToxicKidz ToxicKidz commented Mar 11, 2021

Relevant Issues

Closes #624

Description

I've changed all the ctx.send_help's to bot.get_command("help") and ctx.invoke(help_command, ctx.command.name).

Reasoning

It looks a lot better.

Screenshots

Before:
image

After:
image

Additional Details

Affected commands are .games, .snakes, .space, .emoji, .minesweeper, .movies, .status, .extensions (and its subcommands), and .bemyvalentine.

Did you:

  • Join the Python Discord Community?
  • If dependencies have been added or updated, run pipenv lock?
  • Lint your code (pipenv run lint)?
  • Set the PR to allow edits from contributors?

@ToxicKidz ToxicKidz requested a review from ks129 as a code owner March 11, 2021 23:21
@Xithrius Xithrius added area: backend Related to internal functionality and utilities status: needs review Author is waiting for someone to review and approve type: enhancement Changes or improvements to existing features labels Mar 11, 2021
Copy link
Copy Markdown
Contributor

@Shivansh-007 Shivansh-007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add help_command a class attribute in Bot class in bot/bot.py, then we could just do:

await ctx.invoke(self.bot.help_command, ctx.command.name)

@anand2312
Copy link
Copy Markdown
Contributor

Can we add help_command a class attribute in Bot class in bot/bot.py, then we could just do:

await ctx.invoke(self.bot.help_command, ctx.command.name)

bot.help_command is an attribute of commands.Bot and has to be of type HelpCommand. I don't know how overriding this with something that is not of that type will work.

@Shivansh-007
Copy link
Copy Markdown
Contributor

Can we add help_command a class attribute in Bot class in bot/bot.py, then we could just do:

await ctx.invoke(self.bot.help_command, ctx.command.name)

bot.help_command is an attribute of commands.Bot and has to be of type HelpCommand. I don't know how overriding this with something that is not of that type will work.

Ah right! Forgot about the help_command, didn't meant to override, what I meant was to add another class attribute to the Bot class, so we won't need to do

help_command = self.bot.get_command("help")

everytime we are sending help on a group command.

Copy link
Copy Markdown
Contributor

@Akarys42 Akarys42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

Comment thread bot/utils/extensions.py Outdated
Copy link
Copy Markdown
Member

@ChrisLovering ChrisLovering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@ToxicKidz ToxicKidz requested a review from ks129 March 13, 2021 15:28
@ks129 ks129 merged commit 0f69e00 into python-discord:master Mar 13, 2021
@ToxicKidz ToxicKidz deleted the no-ctx-send-help branch March 31, 2021 23:55
@Xithrius Xithrius removed the status: needs review Author is waiting for someone to review and approve label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backend Related to internal functionality and utilities type: enhancement Changes or improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using group commands without specifying a subcommand sends the default help command.

7 participants