Skip to content

Commit

Permalink
Help and help all, resolve #2847
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjr committed Nov 5, 2020
1 parent 1968f0a commit 59eabf8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
- Added `confirm_thread_creation`, `confirm_thread_creation_title`, `confirm_thread_creation_description`, `confirm_thread_creation_accept`, `confirm_thread_creation_deny` to allow users to confirm that they indeed want to create a new thread. ([GH #2773](https://github.com/kyb3r/modmail/issues/2773))
- Support Gyazo image links in message embeds. ([GH #282](https://github.com/kyb3r/modmail/issues/282))
- Added `silent` argument to `?contact` to restore old behaviour.
- If `?help` is sent, bot does checks on every command, `?help all` restores old behaviour. ([GH #2847](https://github.com/kyb3r/modmail/issues/2847))

### Fixed

Expand Down
17 changes: 16 additions & 1 deletion cogs/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@


class ModmailHelpCommand(commands.HelpCommand):
async def command_callback(self, ctx, *, command=None):
"""Ovrwrites original command_callback to ensure `help` without any arguments
returns with checks, `help all` returns without checks"""
if command is None:
self.verify_checks = True
else:
self.verify_checks = False

if command == 'all':
command = None

return await super().command_callback(ctx, command=command)

async def format_cog_help(self, cog, *, no_cog=False):
bot = self.context.bot
prefix = self.clean_prefix
Expand Down Expand Up @@ -64,6 +77,9 @@ async def format_cog_help(self, cog, *, no_cog=False):
)
embed = discord.Embed(description=f"*{description}*", color=bot.main_color)

if not format_:
continue

embed.add_field(name="Commands", value=format_ or "No commands.")

continued = " (Continued)" if embeds else ""
Expand Down Expand Up @@ -231,7 +247,6 @@ def __init__(self, bot):
self.bot = bot
self._original_help_command = bot.help_command
self.bot.help_command = ModmailHelpCommand(
verify_checks=False,
command_attrs={
"help": "Shows this help message.",
"checks": [checks.has_permissions_predicate(PermissionLevel.REGULAR)],
Expand Down

0 comments on commit 59eabf8

Please sign in to comment.