@@ -39,11 +39,10 @@ async def clear(self, ctx: commands.Context, amount: int | None):
39
39
```
40
40
"""
41
41
if isinstance (amount , int ) and amount is not None :
42
- await ctx .channel .purge (limit = amount )
43
- return await ctx .send (f"🛠️ Deleted **{ amount } ** messages." )
42
+ return await ctx .channel .purge (limit = amount )
44
43
45
44
embed = discord .Embed (
46
- title = "⚠️ You have not selected a number of messages to clear. " ,
45
+ title = "⚠️ You Have Not Selected a Number of Messages to Clear " ,
47
46
description = "❓ Would you like to clear all messages in this channel?" ,
48
47
)
49
48
@@ -87,6 +86,8 @@ async def softban(
87
86
"""
88
87
⚙️ Temporarily bans a member from a server.
89
88
89
+ ❓ If a number of days is not specified, the user is kicked for 1 day.
90
+
90
91
Usage:
91
92
```
92
93
~softban <member> [days] [reason]
@@ -125,27 +126,29 @@ async def blacklist(self, ctx: commands.Context, *, words: str = None):
125
126
if not words :
126
127
view = BlacklistAddView (ctx )
127
128
embed = discord .Embed (
128
- title = "🛠️ Please enter one or more words to blacklist. "
129
+ title = "🛠️ Please Enter One or More Words to Blacklist "
129
130
)
130
131
view .message = await ctx .send (embed = embed , view = view )
131
132
return
132
133
133
134
id = str (ctx .guild .id )
134
- words = [word .lower () for word in words .split (" " )]
135
+ words = {word .strip ().lower () for word in words .split (" " )} - {
136
+ ""
137
+ } # Remove empty strings ''
135
138
136
139
blacklist = self .client .cache .blacklist
137
140
if id not in blacklist .keys ():
138
141
blacklist [id ] = []
139
142
140
143
# Remove words that are already in the blacklist from the words to add.
141
144
# Make a copy so we can add a footer if any words were removed
142
- words_ = set ( words ) - set (blacklist [id ])
145
+ words_ = words - set (blacklist [id ])
143
146
144
147
# If the list of words is zero, we know that none of the words
145
148
# can be added. So, send an error message
146
149
if not words_ :
147
- return await ctx .send (
148
- f"❌ { ctx . author . mention } : Sorry. Those words are already in the blacklist."
150
+ return await ctx .reply (
151
+ f"❌ Those words are already in the blacklist." , delete_after = 20
149
152
)
150
153
151
154
# If duplicate words have been removed, add non-duplicates
@@ -156,7 +159,7 @@ async def blacklist(self, ctx: commands.Context, *, words: str = None):
156
159
self .client .update_json (FILEPATH , blacklist )
157
160
158
161
embed = discord .Embed (
159
- title = f"🛠️ Words successfully added. " ,
162
+ title = f"🛠️ Words Successfully Added " ,
160
163
description = " " .join (f"`{ word } `" for word in words_ ),
161
164
)
162
165
@@ -178,15 +181,14 @@ async def clearblacklist(self, ctx: commands.Context):
178
181
"""
179
182
id = str (ctx .guild .id )
180
183
blacklist = self .client .cache .blacklist
181
- mention = ctx .author .mention
182
184
183
185
if id not in blacklist .keys ():
184
- return await ctx .send (
185
- f"❌ { mention } : This server does not have any words blacklisted."
186
+ return await ctx .reply (
187
+ f"❌ This server does not have any words blacklisted." , delete_after = 20
186
188
)
187
189
188
190
embed = discord .Embed (
189
- title = f"⚠️ Are you sure you 'd like to clear your server 's blacklist ?\n " ,
191
+ title = f"⚠️ Are You Sure You 'd Like to Clear Your Server 's Blacklist ?\n " ,
190
192
description = f"❗ This action cannot be undone." ,
191
193
)
192
194
@@ -208,11 +210,11 @@ async def showblacklist(self, ctx: commands.Context):
208
210
server_id = str (ctx .guild .id )
209
211
210
212
if server_id not in blacklist .keys () or not blacklist [server_id ]:
211
- return await ctx .send (
212
- f"❌ { ctx . author . mention } : This server does not have any words blacklisted."
213
+ return await ctx .reply (
214
+ f"❌ This server does not have any words blacklisted." , delete_after = 20
213
215
)
214
216
215
- embed = discord .Embed (title = "⛔ Blacklist: " )
217
+ embed = discord .Embed (title = "⛔ Blacklist" )
216
218
embed .description = "" .join ([f" `{ word } ` " for word in blacklist [server_id ]])
217
219
218
220
await ctx .send (embed = embed )
@@ -230,30 +232,30 @@ async def blacklistremove(self, ctx: commands.Context, *, words: str = None):
230
232
"""
231
233
if not words :
232
234
view = BlacklistRemoveView (ctx )
233
- embed = discord .Embed (
234
- title = "🛠️ Please enter one or more words to remove from the blacklist."
235
- )
235
+ embed = discord .Embed (title = "🛠️ Please Enter One or More Words to Remove" )
236
236
237
237
view .message = await ctx .send (embed = embed , view = view )
238
238
return
239
239
240
240
id = str (ctx .guild .id )
241
- words = {word .lower () for word in words .split (" " )}
241
+ words = {word .strip ().lower () for word in words .split (" " )} - {
242
+ ""
243
+ } # Remove empty strings ''
242
244
243
245
blacklist = self .client .cache .blacklist
244
246
245
247
if id not in blacklist .keys ():
246
- return await ctx .send (
247
- f"❌ { ctx . author . mention } : This server does not have any words blacklisted."
248
+ return await ctx .reply (
249
+ f"❌ This server does not have any words blacklisted." , delete_after = 20
248
250
)
249
251
250
252
# Only remove words that are already in the blacklist from the words to remove.
251
253
# Make a copy so we can add a footer if any words were removed
252
254
words_ = words & set (blacklist [id ])
253
255
254
256
if not words_ :
255
- return await ctx .send (
256
- f"❌ { ctx . author . mention } : Sorry. Those words are not in the blacklist."
257
+ return await ctx .reply (
258
+ f"❌ Those words are not in the blacklist." , delete_after = 20
257
259
)
258
260
259
261
# If duplicate words have been removed, remove non-duplicates
@@ -264,7 +266,7 @@ async def blacklistremove(self, ctx: commands.Context, *, words: str = None):
264
266
self .client .update_json (FILEPATH , blacklist )
265
267
266
268
embed = discord .Embed (
267
- title = f"🛠️ Words successfully removed. " ,
269
+ title = f"🛠️ Words Successfully Removed " ,
268
270
description = " " .join (f"`{ word } `" for word in words_ ),
269
271
)
270
272
0 commit comments