Skip to content

Commit c90c552

Browse files
committed
Fixed ~blshow error, where it displays the embed if the blacklist is empty
1 parent 117be46 commit c90c552

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

cogs/admin/admin_cog.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
import discord
77

88
from discord.ext import commands
9-
from utils import BlacklistClearButton, BlacklistAddView, BlacklistRemoveView, ClearMessagesView, lift_ban, sanction
9+
from utils import (
10+
BlacklistClearButton,
11+
BlacklistAddView,
12+
BlacklistRemoveView,
13+
ClearMessagesView,
14+
lift_ban,
15+
sanction,
16+
)
1017

1118
FILEPATH = "files/blacklist.json"
1219

@@ -106,7 +113,7 @@ async def unban(self, ctx: commands.Context, user: discord.User):
106113
@commands.command(aliases=["bladd"])
107114
@commands.has_permissions(manage_messages=True)
108115
@commands.cooldown(1, 2, commands.BucketType.user)
109-
async def blacklist(self, ctx: commands.Context, *, words: str=None):
116+
async def blacklist(self, ctx: commands.Context, *, words: str = None):
110117
"""
111118
⚙️ Bans words from being used.
112119
@@ -200,7 +207,7 @@ async def showblacklist(self, ctx: commands.Context):
200207
blacklist = self.client.cache.blacklist
201208
server_id = str(ctx.guild.id)
202209

203-
if server_id not in blacklist.keys():
210+
if server_id not in blacklist.keys() or not blacklist[server_id]:
204211
return await ctx.send(
205212
f"❌ {ctx.author.mention}: This server does not have any words blacklisted."
206213
)
@@ -212,7 +219,7 @@ async def showblacklist(self, ctx: commands.Context):
212219

213220
@commands.command(aliases=["blrem"])
214221
@commands.has_permissions(manage_messages=True)
215-
async def blacklistremove(self, ctx: commands.Context, *, words: str=None):
222+
async def blacklistremove(self, ctx: commands.Context, *, words: str = None):
216223
"""
217224
⚙️ Removes a word from the list of banned words.
218225

files/blacklist.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"953054451999072276": [
3-
"arse"
4-
]
5-
}
1+
{}

0 commit comments

Comments
 (0)