From dfbecd2077c72d7475aaece4a3f92a12b56a207c Mon Sep 17 00:00:00 2001 From: Sebastiaan Zeeff <33516116+SebastiaanZ@users.noreply.github.com> Date: Mon, 6 Apr 2020 18:06:39 +0200 Subject: Use configurable prefix to clean help channel names The help channel prefix is configurable as a constant, but I accidentally used a static prefix in the utility function that cleaned the channel names. This commit makes sure the utility method uses the prefix defined in the constants. --- bot/cogs/help_channels.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index 60580695c..2e203df46 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -223,13 +223,14 @@ class HelpChannels(Scheduler, commands.Cog): @staticmethod def get_clean_channel_name(channel: discord.TextChannel) -> str: """Return a clean channel name without status emojis prefix.""" + prefix = constants.HelpChannels.name_prefix try: - # Try to remove the status prefix using the index of "help-" - name = channel.name[channel.name.index("help-"):] + # Try to remove the status prefix using the index of the channel prefix + name = channel.name[channel.name.index(prefix):] log.trace(f"The clean name for `{channel}` is `{name}`") except ValueError: # If, for some reason, the channel name does not contain "help-" fall back gracefully - log.info(f"Can't get clean name as `{channel}` does not follow the `help-` naming convention.") + log.info(f"Can't get clean name as `{channel}` does not follow the `{prefix}` naming convention.") name = channel.name return name -- cgit v1.2.3