3
3
Description:
4
4
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
5
5
6
- Version: 5.4.1
6
+ Version: 5.4.2
7
7
"""
8
8
9
9
import discord
@@ -260,6 +260,39 @@ async def blacklist(self, context: Context) -> None:
260
260
)
261
261
await context .send (embed = embed )
262
262
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
+
263
296
@blacklist .command (
264
297
base = "blacklist" ,
265
298
name = "add" ,
@@ -278,7 +311,7 @@ async def blacklist_add(self, context: Context, user: discord.User) -> None:
278
311
if await db_manager .is_blacklisted (user_id ):
279
312
embed = discord .Embed (
280
313
title = "Error!" ,
281
- description = f"**{ user .name } ** is not in the blacklist." ,
314
+ description = f"**{ user .name } ** is already in the blacklist." ,
282
315
color = 0xE02B2B
283
316
)
284
317
await context .send (embed = embed )
@@ -290,7 +323,7 @@ async def blacklist_add(self, context: Context, user: discord.User) -> None:
290
323
color = 0x9C84EF
291
324
)
292
325
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"
294
327
)
295
328
await context .send (embed = embed )
296
329
@@ -312,7 +345,7 @@ async def blacklist_remove(self, context: Context, user: discord.User) -> None:
312
345
if not await db_manager .is_blacklisted (user_id ):
313
346
embed = discord .Embed (
314
347
title = "Error!" ,
315
- description = f"**{ user .name } ** is already in the blacklist." ,
348
+ description = f"**{ user .name } ** is not in the blacklist." ,
316
349
color = 0xE02B2B
317
350
)
318
351
await context .send (embed = embed )
@@ -324,7 +357,7 @@ async def blacklist_remove(self, context: Context, user: discord.User) -> None:
324
357
color = 0x9C84EF
325
358
)
326
359
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"
328
361
)
329
362
await context .send (embed = embed )
330
363
0 commit comments