|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 |
| -from typing import TYPE_CHECKING, Annotated, Optional |
| 3 | +from typing import TYPE_CHECKING, Annotated, Optional, Union |
4 | 4 |
|
5 | 5 | import asyncpg
|
6 | 6 | import discord
|
@@ -133,6 +133,12 @@ async def get_guild_config(self, guild_id: int) -> Optional[GuildConfig]:
|
133 | 133 | config = GuildConfig(bot=self.bot, **dict(rows))
|
134 | 134 | return config
|
135 | 135 |
|
| 136 | + def clean_prefixes(self, prefixes: Union[str, list[str]]) -> str: |
| 137 | + if isinstance(prefixes, str): |
| 138 | + return f"`{prefixes}`" |
| 139 | + |
| 140 | + return ", ".join(f"`{prefix}`" for prefix in prefixes[2:]) |
| 141 | + |
136 | 142 | @check_permissions(manage_guild=True)
|
137 | 143 | @bot_check_permissions(manage_channels=True, manage_webhooks=True)
|
138 | 144 | @commands.guild_only()
|
@@ -355,13 +361,9 @@ async def prefix(self, ctx: GuildContext) -> None:
|
355 | 361 |
|
356 | 362 | Passing in no subcommands will effectively show the currently set prefixes.
|
357 | 363 | """
|
358 |
| - user_id = self.bot.user.id # type: ignore |
359 | 364 | prefixes = await get_prefix(self.bot, ctx.message)
|
360 |
| - cleaned = ", ".join( |
361 |
| - f"`{prefix}`" for prefix in prefixes if str(user_id) not in prefix |
362 |
| - ) |
363 | 365 | embed = Embed()
|
364 |
| - embed.add_field(name="Prefixes", value=cleaned) |
| 366 | + embed.add_field(name="Prefixes", value=self.clean_prefixes(prefixes)) |
365 | 367 | embed.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon.url) # type: ignore
|
366 | 368 | await ctx.send(embed=embed)
|
367 | 369 |
|
|
0 commit comments