List watched channels: fix: message when no channels are watched was showing incorrect command to register them
This commit is contained in:
parent
e9880e38a8
commit
c17ff210f5
|
|
@ -54,9 +54,9 @@ class VocalMaisBot(commands.Cog):
|
||||||
await ctx.send(f":dragon_face: Only an administrator can control me!")
|
await ctx.send(f":dragon_face: Only an administrator can control me!")
|
||||||
raise discord_utils.CheckFailDoNotNotify
|
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]
|
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()
|
@commands.Cog.listener()
|
||||||
async def on_command_error(self, ctx: commands.Context, error: commands.CommandError):
|
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: <deleted channel> ({channel_id})")
|
answer_lines.append(f":ninja: <deleted channel> ({channel_id})")
|
||||||
await ctx.send(embed = discord.Embed(title = "I am watching the following channels", description = "\n".join(answer_lines)))
|
await ctx.send(embed = discord.Embed(title = "I am watching the following channels", description = "\n".join(answer_lines)))
|
||||||
else:
|
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")
|
@guild_subcommands.command("clear", help = "Make me stop watching all channels")
|
||||||
async def clear_watched_channels(self, ctx: commands.Context):
|
async def clear_watched_channels(self, ctx: commands.Context):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue