File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1499,3 +1499,38 @@ async def modmail_unban(
14991499 message = f"{ user .mention } was successfully unbanned from creating modmail threads!" ,
15001500 channel = ctx .channel ,
15011501 )
1502+
1503+ @auxiliary .with_typing
1504+ @commands .check (has_modmail_management_role )
1505+ @modmail .command (
1506+ name = "bans" ,
1507+ description = "Lists the users who are banned from using modmail" ,
1508+ )
1509+ async def modmail_list_bans (self : Self , ctx : commands .Context ) -> None :
1510+ """Lists the users who are banned from using modmail
1511+
1512+ Args:
1513+ ctx (commands.Context): Context of the command execution
1514+ """
1515+ bans = await self .bot .models .ModmailBan .query .gino .all ()
1516+ if not bans :
1517+ embed = auxiliary .generate_basic_embed (
1518+ color = discord .Color .green (),
1519+ description = "There are no modmail bans" ,
1520+ )
1521+ await ctx .channel .send (embed = embed )
1522+ return
1523+
1524+ embed_description = ""
1525+
1526+ for ban in bans :
1527+ user : discord .User = await self .bot .fetch_user (ban .user_id )
1528+ embed_description += f"{ user .mention } - `{ user } `\n "
1529+
1530+ embed : discord .Embed = discord .Embed (
1531+ color = discord .Color .green (),
1532+ title = "Modmail Bans:" ,
1533+ description = embed_description ,
1534+ )
1535+
1536+ await ctx .channel .send (embed = embed )
You can’t perform that action at this time.
0 commit comments