33Description:
44🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
55
6- Version: 5.4.1
6+ Version: 5.4.2
77"""
88
99import discord
@@ -260,6 +260,39 @@ async def blacklist(self, context: Context) -> None:
260260 )
261261 await context .send (embed = embed )
262262
263+ @blacklist .command (
264+ base = "blacklist" ,
265+ name = "show" ,
266+ description = "Shows the list of all blacklisted users." ,
267+ )
268+ @checks .is_owner ()
269+ async def blacklist_show (self , context : Context ) -> None :
270+ """
271+ Shows the list of all blacklisted users.
272+
273+ :param context: The hybrid command context.
274+ """
275+ blacklisted_users = await db_manager .get_blacklisted_users ()
276+ if len (blacklisted_users ) == 0 :
277+ embed = discord .Embed (
278+ description = "There are currently no blacklisted users." ,
279+ color = 0xE02B2B
280+ )
281+ await context .send (embed = embed )
282+ return
283+
284+ embed = discord .Embed (
285+ title = "Blacklisted users" ,
286+ color = 0x9C84EF
287+ )
288+ users = []
289+ for bluser in blacklisted_users :
290+ user = self .bot .get_user (int (bluser [0 ])) or await self .bot .fetch_user (int (bluser [0 ]))
291+ users .append (
292+ f"• { user .mention } ({ user } ) - Blacklisted <t:{ bluser [1 ]} >" )
293+ embed .description = "\n " .join (users )
294+ await context .send (embed = embed )
295+
263296 @blacklist .command (
264297 base = "blacklist" ,
265298 name = "add" ,
@@ -278,7 +311,7 @@ async def blacklist_add(self, context: Context, user: discord.User) -> None:
278311 if await db_manager .is_blacklisted (user_id ):
279312 embed = discord .Embed (
280313 title = "Error!" ,
281- description = f"**{ user .name } ** is not in the blacklist." ,
314+ description = f"**{ user .name } ** is already in the blacklist." ,
282315 color = 0xE02B2B
283316 )
284317 await context .send (embed = embed )
@@ -290,7 +323,7 @@ async def blacklist_add(self, context: Context, user: discord.User) -> None:
290323 color = 0x9C84EF
291324 )
292325 embed .set_footer (
293- text = f"There are now { total } { 'user' if total == 1 else 'users' } in the blacklist"
326+ text = f"There { 'is' if total == 1 else ' are' } now { total } { 'user' if total == 1 else 'users' } in the blacklist"
294327 )
295328 await context .send (embed = embed )
296329
@@ -312,7 +345,7 @@ async def blacklist_remove(self, context: Context, user: discord.User) -> None:
312345 if not await db_manager .is_blacklisted (user_id ):
313346 embed = discord .Embed (
314347 title = "Error!" ,
315- description = f"**{ user .name } ** is already in the blacklist." ,
348+ description = f"**{ user .name } ** is not in the blacklist." ,
316349 color = 0xE02B2B
317350 )
318351 await context .send (embed = embed )
@@ -324,7 +357,7 @@ async def blacklist_remove(self, context: Context, user: discord.User) -> None:
324357 color = 0x9C84EF
325358 )
326359 embed .set_footer (
327- text = f"There are now { total } { 'user' if total == 1 else 'users' } in the blacklist"
360+ text = f"There { 'is' if total == 1 else ' are' } now { total } { 'user' if total == 1 else 'users' } in the blacklist"
328361 )
329362 await context .send (embed = embed )
330363
0 commit comments