diff --git a/CHANGELOG.md b/CHANGELOG.md index 56d4949..89a7501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `?worksplit` command. - Maps for CQ Zones, ITU Zones, ITU Regions, and Canadian prefixes. - Attribution for all maps. +- Option to append ` | ?help` to the playing status. ### Changed - ARRL/RAC section maps to include all current ARRL/RAC sections. +### Fixed +- Issue where multiple prefixes were not handled properly. ## [2.3.2] - 2020-07-22 diff --git a/exts/base.py b/exts/base.py index c32ed9b..789bece 100644 --- a/exts/base.py +++ b/exts/base.py @@ -46,9 +46,9 @@ class QrmHelpCommand(commands.HelpCommand): if parent: fmt = f"{parent} {fmt}" alias = fmt - return f"{opt.prefix}{alias} {command.signature}\n *Aliases:* {aliases}" + return f"{opt.display_prefix}{alias} {command.signature}\n *Aliases:* {aliases}" alias = command.name if not parent else f"{parent} {command.name}" - return f"{opt.prefix}{alias} {command.signature}" + return f"{opt.display_prefix}{alias} {command.signature}" async def send_error_message(self, error): embed = cmn.embed_factory(self.context) @@ -60,7 +60,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.prefix}help [command name]`." + embed.description = (f"For command-specific help and usage, use `{opt.display_prefix}help [command name]`." " Many commands have shorter aliases.") mapping = await mapping diff --git a/main.py b/main.py index bc9f919..462a06c 100644 --- a/main.py +++ b/main.py @@ -193,7 +193,10 @@ async def _ensure_activity_time(): try: tz = pytz.timezone(opt.status_tz) except pytz.exceptions.UnknownTimeZoneError: - await bot.change_presence(activity=discord.Game(name="with invalid timezones.")) + status = "with invalid timezones" + if opt.show_help: + status += f" | {opt.display_prefix}help" + await bot.change_presence(activity=discord.Game(name=status)) return now = datetime.now(tz=tz).time() @@ -203,6 +206,8 @@ async def _ensure_activity_time(): end_time = time(hour=sts[2][0], minute=sts[2][1], tzinfo=tz) if start_time < now <= end_time: status = sts[0] + if opt.show_help: + status += f" | {opt.display_prefix}help" await bot.change_presence(activity=discord.Game(name=status)) @@ -210,6 +215,8 @@ async def _ensure_activity_time(): @tasks.loop(minutes=5) async def _ensure_activity_random(): status = random.choice(opt.statuses) + if opt.show_help: + status += f" | {opt.display_prefix}help" await bot.change_presence(activity=discord.Game(name=status)) @@ -217,6 +224,8 @@ async def _ensure_activity_random(): @tasks.loop(minutes=5) async def _ensure_activity_fixed(): status = opt.statuses[0] + if opt.show_help: + status += f" | {opt.display_prefix}help" await bot.change_presence(activity=discord.Game(name=status)) diff --git a/templates/data/options.py b/templates/data/options.py index ca127a9..a588d55 100644 --- a/templates/data/options.py +++ b/templates/data/options.py @@ -15,7 +15,10 @@ Settings and options for the bot. # The prefix for the bot (str). Define a list of stings for multiple prefixes. # ie: `["?", "!", "pls "]` -prefix = "?" +prefix = ["? ", "?"] + +# The prefix to use for display purposes (ex: status message). +display_prefix = "?" # Whether the bot should print full stacktraces for normal exceptions: `True`, # or be nice and only print small messages: `False` (the default). @@ -46,6 +49,9 @@ time_statuses = [("with lids on 3.840", (00, 00), (6, 00)), ("with lids on 7.200", (18, 00), (20, 00)), ("with lids on 3.840", (20, 00), (23, 59))] +# append " | {display_prefix}help" to the Discord playing status +show_help = False + # Emoji IDs and keywords for emoji reactions # Use the format {emoji_id (int): ("tuple", "of", "lowercase", "keywords")} msg_reacts = {}