Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions techsupport_bot/commands/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -1499,3 +1499,38 @@ async def modmail_unban(
message=f"{user.mention} was successfully unbanned from creating modmail threads!",
channel=ctx.channel,
)

@auxiliary.with_typing
@commands.check(has_modmail_management_role)
@modmail.command(
name="bans",
description="Lists the users who are banned from using modmail",
)
async def modmail_list_bans(self: Self, ctx: commands.Context) -> None:
"""Lists the users who are banned from using modmail

Args:
ctx (commands.Context): Context of the command execution
"""
bans = await self.bot.models.ModmailBan.query.gino.all()
if not bans:
embed = auxiliary.generate_basic_embed(
color=discord.Color.green(),
description="There are no modmail bans",
)
await ctx.channel.send(embed=embed)
return

embed_description = ""

for ban in bans:
user: discord.User = await self.bot.fetch_user(ban.user_id)
embed_description += f"{user.mention} - `{user}`\n"

embed: discord.Embed = discord.Embed(
color=discord.Color.green(),
title="Modmail Bans:",
description=embed_description,
)

await ctx.channel.send(embed=embed)
Loading