Skip to content

Commit 311df32

Browse files
committed
Show total set prefixes and break conditions up more clearly
1 parent 8e225c6 commit 311df32

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

bot/cogs/config.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,16 @@ async def delete(self, ctx: GuildContext) -> None:
357357
@commands.guild_only()
358358
@config.group(name="prefix", fallback="info")
359359
async def prefix(self, ctx: GuildContext) -> None:
360-
"""Manages custom prefixes for the guild.
360+
"""Shows and manages custom prefixes for the guild
361361
362362
Passing in no subcommands will effectively show the currently set prefixes.
363363
"""
364364
prefixes = await get_prefix(self.bot, ctx.message)
365365
embed = Embed()
366-
embed.add_field(name="Prefixes", value=self.clean_prefixes(prefixes))
366+
embed.add_field(
367+
name="Prefixes", value=self.clean_prefixes(prefixes), inline=False
368+
)
369+
embed.add_field(name="Total", value=len(prefixes) - 2, inline=False)
367370
embed.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon.url) # type: ignore
368371
await ctx.send(embed=embed)
369372

@@ -374,15 +377,15 @@ async def prefix_add(
374377
) -> None:
375378
"""Adds an custom prefix"""
376379
prefixes = await get_prefix(self.bot, ctx.message)
377-
if isinstance(prefixes, list) and len(prefixes) > 12 or prefix in prefixes:
378-
desc = (
379-
"There was a validation issue. "
380-
"This is caused by these reasons: \n"
381-
"- You have more than 12 prefixes for your server\n"
382-
"- Your prefix fails the validation rules\n"
383-
"- The prefix you want to set already exists"
380+
381+
# 2 are the mention prefixes, which are always prepended on the list of prefixes
382+
if isinstance(prefixes, list) and len(prefixes) > 12:
383+
await ctx.send(
384+
"You can not have more than 10 custom prefixes for your server"
384385
)
385-
await ctx.send(desc)
386+
return
387+
elif prefix in prefixes:
388+
await ctx.send("The prefix you want to set already exists")
386389
return
387390

388391
query = """

0 commit comments

Comments
 (0)