From c17ff210f5efcc0166cfcc101ad0f566ffb24654 Mon Sep 17 00:00:00 2001 From: Elnath Date: Sun, 24 Jan 2021 02:47:45 +0100 Subject: [PATCH] List watched channels: fix: message when no channels are watched was showing incorrect command to register them --- VocalMaisBot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VocalMaisBot.py b/VocalMaisBot.py index bda8cce..607c97b 100755 --- a/VocalMaisBot.py +++ b/VocalMaisBot.py @@ -54,9 +54,9 @@ class VocalMaisBot(commands.Cog): await ctx.send(f":dragon_face: Only an administrator can control me!") raise discord_utils.CheckFailDoNotNotify - def get_command_usage_message(self, command: commands.Command) -> str: + def get_command_usage_message(self, command: commands.Command, prepend = "Usage: ") -> str: command_elements = [str(cmd) for cmd in command.parents] + [command.name] - return f"Usage: `@{self.bot.user.display_name} {' '.join(command_elements)} {command.signature}`" + return f"{prepend}`@{self.bot.user.display_name} {' '.join(command_elements)} {command.signature}`" @commands.Cog.listener() async def on_command_error(self, ctx: commands.Context, error: commands.CommandError): @@ -164,7 +164,7 @@ class VocalMaisBot(commands.Cog): answer_lines.append(f":ninja: ({channel_id})") await ctx.send(embed = discord.Embed(title = "I am watching the following channels", description = "\n".join(answer_lines))) else: - await ctx.send(f":see_no_evil: I am not watching any voice channel! Do not hesitate to add some by running `@{self.bot.user.display_name} {self.register_channel.name} {self.register_channel.signature}`") + await ctx.send(f":see_no_evil: I am not watching any voice channel! Do not hesitate to add some by running {self.get_command_usage_message(self.register_channel, '')}") @guild_subcommands.command("clear", help = "Make me stop watching all channels") async def clear_watched_channels(self, ctx: commands.Context):