@@ -147,15 +147,21 @@ async def snippets_add(self, ctx, name: str.lower, *, value):
147
147
{prefix}snippets add "two word" this is a two word snippet.
148
148
```
149
149
"""
150
+ if name in self .bot .config .snippets :
151
+ embed = discord .Embed (
152
+ title = "Error" ,
153
+ color = discord .Color .red (),
154
+ description = f"Snippet `{ name } ` already exists." ,
155
+ )
156
+ else :
157
+ self .bot .config .snippets [name ] = value
158
+ await self .bot .config .update ()
150
159
151
- self .bot .config .snippets [name ] = value
152
- await self .bot .config .update ()
153
-
154
- embed = discord .Embed (
155
- title = "Added snippet" ,
156
- color = self .bot .main_color ,
157
- description = f"`{ name } ` points to: { value } " ,
158
- )
160
+ embed = discord .Embed (
161
+ title = "Added snippet" ,
162
+ color = self .bot .main_color ,
163
+ description = f'`{ name } ` will now send "{ value } ".' ,
164
+ )
159
165
160
166
await ctx .send (embed = embed )
161
167
@@ -164,7 +170,7 @@ async def snippets_add(self, ctx, name: str.lower, *, value):
164
170
async def snippets_remove (self , ctx , * , name : str .lower ):
165
171
"""Remove a snippet."""
166
172
167
- if self .bot .config .snippets . get ( name ) :
173
+ if name in self .bot .config .snippets :
168
174
embed = discord .Embed (
169
175
title = "Removed snippet" ,
170
176
color = self .bot .main_color ,
@@ -182,6 +188,27 @@ async def snippets_remove(self, ctx, *, name: str.lower):
182
188
183
189
await ctx .send (embed = embed )
184
190
191
+ @snippets .command (name = "edit" )
192
+ @checks .has_permissions (PermissionLevel .SUPPORTER )
193
+ async def snippets_edit (self , ctx , name : str .lower , * , value ):
194
+ if name in self .bot .config .snippets :
195
+ self .bot .config .snippets [name ] = value
196
+ await self .bot .config .update ()
197
+
198
+ embed = discord .Embed (
199
+ title = "Edited snippet" ,
200
+ color = self .bot .main_color ,
201
+ description = f'`{ name } ` will now send "{ value } ".' ,
202
+ )
203
+
204
+ else :
205
+ embed = discord .Embed (
206
+ title = "Error" ,
207
+ color = discord .Color .red (),
208
+ description = f"Snippet `{ name } ` does not exist." ,
209
+ )
210
+ await ctx .send (embed = embed )
211
+
185
212
@commands .command ()
186
213
@checks .has_permissions (PermissionLevel .MODERATOR )
187
214
@checks .thread_only ()
@@ -193,7 +220,11 @@ async def move(self, ctx, *, category: discord.CategoryChannel):
193
220
"""
194
221
thread = ctx .thread
195
222
await thread .channel .edit (category = category , sync_permissions = True )
196
- await ctx .message .add_reaction ("✅" )
223
+ sent_emoji , _ = await self .bot .retrieve_emoji ()
224
+ try :
225
+ await ctx .message .add_reaction (sent_emoji )
226
+ except (discord .HTTPException , discord .InvalidArgument ):
227
+ pass
197
228
198
229
@staticmethod
199
230
async def send_scheduled_close_message (ctx , after , silent = False ):
@@ -823,16 +854,16 @@ async def blocked_whitelist(self, ctx, *, user: User = None):
823
854
mention = getattr (user , "mention" , f"`{ user .id } `" )
824
855
msg = ""
825
856
826
- if str (user .id ) in self .bot .config . blocked_whitelist :
857
+ if str (user .id ) in self .bot .blocked_whitelisted_users :
827
858
embed = discord .Embed (
828
859
title = "Success" ,
829
860
description = f"{ mention } is no longer whitelisted." ,
830
861
color = self .bot .main_color ,
831
862
)
832
- self .bot .config . blocked_whitelist .remove (str (user .id ))
863
+ self .bot .blocked_whitelisted_users .remove (str (user .id ))
833
864
return await ctx .send (embed = embed )
834
865
835
- self .bot .config . blocked_whitelist .append (str (user .id ))
866
+ self .bot .blocked_whitelisted_users .append (str (user .id ))
836
867
837
868
if str (user .id ) in self .bot .blocked_users :
838
869
msg = self .bot .blocked_users .get (str (user .id ))
@@ -891,7 +922,7 @@ async def block(
891
922
892
923
mention = getattr (user , "mention" , f"`{ user .id } `" )
893
924
894
- if str (user .id ) in self .bot .config . blocked_whitelist :
925
+ if str (user .id ) in self .bot .blocked_whitelisted_users :
895
926
embed = discord .Embed (
896
927
title = "Error" ,
897
928
description = f"Cannot block { mention } , user is whitelisted." ,
0 commit comments