From ab730013407de966f765bea31a0f13123b6b39ab Mon Sep 17 00:00:00 2001 From: 0x5c Date: Sat, 13 Mar 2021 17:48:18 -0500 Subject: [PATCH 1/2] Made help command use the invocation prefix Fixes #338 --- CHANGELOG.md | 1 + exts/base.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a4f04..df66b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Renamed `?cond` to `?solar`. ### Fixed - Weird image caching situation for `?greyline` on Discord's side. +- The help command was not using the prefix it was invoked with. ### Deprecated - `?ungrid`. - Deprecated old `?solar` aliases (`?cond`, etc). diff --git a/exts/base.py b/exts/base.py index 970373b..9f58854 100644 --- a/exts/base.py +++ b/exts/base.py @@ -18,13 +18,12 @@ import discord.ext.commands as commands import info import common as cmn -import data.options as opt - class QrmHelpCommand(commands.HelpCommand): def __init__(self): super().__init__(command_attrs={"help": "Shows help about qrm or a command", "aliases": ["h"]}) self.verify_checks = True + self.context: commands.Context async def get_bot_mapping(self): bot = self.context.bot @@ -46,9 +45,9 @@ class QrmHelpCommand(commands.HelpCommand): if parent: fmt = f"{parent} {fmt}" alias = fmt - return f"{opt.display_prefix}{alias} {command.signature}\n *Aliases:* {aliases}" + return f"{self.context.prefix}{alias} {command.signature}\n *Aliases:* {aliases}" alias = command.name if not parent else f"{parent} {command.name}" - return f"{opt.display_prefix}{alias} {command.signature}" + return f"{self.context.prefix}{alias} {command.signature}" async def send_error_message(self, error): embed = cmn.embed_factory(self.context) @@ -60,7 +59,7 @@ class QrmHelpCommand(commands.HelpCommand): async def send_bot_help(self, mapping): embed = cmn.embed_factory(self.context) embed.title = "qrm Help" - embed.description = (f"For command-specific help and usage, use `{opt.display_prefix}help [command name]`." + embed.description = (f"For command-specific help and usage, use `{self.context.prefix}help [command name]`." " Many commands have shorter aliases.") mapping = await mapping From 78e34dff6329c658d0a9ca6716a78b6135e568b1 Mon Sep 17 00:00:00 2001 From: 0x5c Date: Sat, 13 Mar 2021 18:16:58 -0500 Subject: [PATCH 2/2] Added list of available prexifes to ?help - Only shows when more then one is available. Fixes #353 --- CHANGELOG.md | 1 + exts/base.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df66b78..ac5da15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Added - MUF and foF2 maps from [prop.kc2g.com](https://prop.kc2g.com/). +- The list of available prefixes to `?help` when there is more than one. ### Changed - New colour theme for `?greyline`. - Moved great circle distance and bearing calculation from `?ungrid` to `?griddistance`. diff --git a/exts/base.py b/exts/base.py index 9f58854..3ac48a6 100644 --- a/exts/base.py +++ b/exts/base.py @@ -61,6 +61,9 @@ class QrmHelpCommand(commands.HelpCommand): embed.title = "qrm Help" embed.description = (f"For command-specific help and usage, use `{self.context.prefix}help [command name]`." " Many commands have shorter aliases.") + if isinstance(self.context.bot.command_prefix, list): + embed.description += (" All of the following prefixes work with the bot: `" + + "`, `".join(self.context.bot.command_prefix) + "`.") mapping = await mapping for cat, cmds in mapping.items():