@@ -266,26 +266,26 @@ async def close(self, ctx, *, after: UserFriendlyTime = None):
266266 @commands .command (aliases = ['alert' ])
267267 @checks .has_permissions (PermissionLevel .SUPPORTER )
268268 @checks .thread_only ()
269- async def notify (self , ctx , * , role : Union [discord .Role , str .lower , None ] = None ):
269+ async def notify (self , ctx , * , user_or_role : Union [discord .Role , User , str .lower , None ] = None ):
270270 """
271- Notify a role or yourself when the next thread message received.
271+ Notify a user, role, or yourself when the next thread message received.
272272
273- Once a thread message is received, `role ` will only be pinged once.
273+ Once a thread message is received, `user_or_role ` will only be pinged once.
274274
275- Leave `role ` empty to notify yourself.
275+ Leave `user_or_role ` empty to notify yourself.
276276 `@here` and `@everyone` can be substituted with `here` and `everyone`.
277- `role ` may be a role ID, mention, name, "everyone", or "here".
277+ `user_or_role ` may be a user ID, mention, name. role ID, mention, name, "everyone", or "here".
278278 """
279279 thread = ctx .thread
280280
281- if role is None :
281+ if user_or_role is None :
282282 mention = ctx .author .mention
283- elif isinstance ( role , discord . Role ):
284- mention = role .mention
285- elif role in {'here' , 'everyone' , '@here' , '@everyone' }:
286- mention = '@' + role .lstrip ('@' )
283+ elif hasattr ( user_or_role , 'mention' ):
284+ mention = user_or_role .mention
285+ elif user_or_role in {'here' , 'everyone' , '@here' , '@everyone' }:
286+ mention = '@' + user_or_role .lstrip ('@' )
287287 else :
288- raise commands .BadArgument (f'{ role } is not a valid role.' )
288+ raise commands .BadArgument (f'{ user_or_role } is not a valid role.' )
289289
290290 if str (thread .id ) not in self .bot .config ['notification_squad' ]:
291291 self .bot .config ['notification_squad' ][str (thread .id )] = []
@@ -304,29 +304,68 @@ async def notify(self, ctx, *, role: Union[discord.Role, str.lower, None] = None
304304 'on the next message received.' )
305305 return await ctx .send (embed = embed )
306306
307+ @commands .command (aliases = ['unalert' ])
308+ @checks .has_permissions (PermissionLevel .SUPPORTER )
309+ @checks .thread_only ()
310+ async def unnotify (self , ctx , * , user_or_role : Union [discord .Role , User , str .lower , None ] = None ):
311+ """
312+ Un-notify a user, role, or yourself from a thread.
313+
314+ Leave `user_or_role` empty to un-notify yourself.
315+ `@here` and `@everyone` can be substituted with `here` and `everyone`.
316+ `user_or_role` may be a user ID, mention, name, role ID, mention, name, "everyone", or "here".
317+ """
318+ thread = ctx .thread
319+
320+ if user_or_role is None :
321+ mention = ctx .author .mention
322+ elif hasattr (user_or_role , 'mention' ):
323+ mention = user_or_role .mention
324+ elif user_or_role in {'here' , 'everyone' , '@here' , '@everyone' }:
325+ mention = '@' + user_or_role .lstrip ('@' )
326+ else :
327+ mention = f'`{ user_or_role } `'
328+
329+ if str (thread .id ) not in self .bot .config ['notification_squad' ]:
330+ self .bot .config ['notification_squad' ][str (thread .id )] = []
331+
332+ mentions = self .bot .config ['notification_squad' ][str (thread .id )]
333+
334+ if mention not in mentions :
335+ embed = discord .Embed (color = discord .Color .red (),
336+ description = f'{ mention } does not have a '
337+ 'pending notification.' )
338+ else :
339+ mentions .remove (mention )
340+ await self .bot .config .update ()
341+ embed = discord .Embed (color = self .bot .main_color ,
342+ description = f'{ mention } will no longer '
343+ 'be notified.' )
344+ return await ctx .send (embed = embed )
345+
307346 @commands .command (aliases = ['sub' ])
308347 @checks .has_permissions (PermissionLevel .SUPPORTER )
309348 @checks .thread_only ()
310- async def subscribe (self , ctx , * , role : Union [discord .Role , str .lower , None ] = None ):
349+ async def subscribe (self , ctx , * , user_or_role : Union [discord .Role , User , str .lower , None ] = None ):
311350 """
312- Notify a role or yourself for every thread message received.
351+ Notify a user, role, or yourself for every thread message received.
313352
314353 You will be pinged for every thread message received until you unsubscribe.
315354
316- Leave `role ` empty to subscribe yourself.
355+ Leave `user_or_role ` empty to subscribe yourself.
317356 `@here` and `@everyone` can be substituted with `here` and `everyone`.
318- `role ` may be a role ID, mention, name, "everyone", or "here".
357+ `user_or_role ` may be a user ID, mention, name, role ID, mention, name, "everyone", or "here".
319358 """
320359 thread = ctx .thread
321360
322- if role is None :
361+ if user_or_role is None :
323362 mention = ctx .author .mention
324- elif isinstance ( role , discord . Role ):
325- mention = role .mention
326- elif role in {'here' , 'everyone' , '@here' , '@everyone' }:
327- mention = '@' + role .lstrip ('@' )
363+ elif hasattr ( user_or_role , 'mention' ):
364+ mention = user_or_role .mention
365+ elif user_or_role in {'here' , 'everyone' , '@here' , '@everyone' }:
366+ mention = '@' + user_or_role .lstrip ('@' )
328367 else :
329- raise commands .BadArgument (f'{ role } is not a valid role.' )
368+ raise commands .BadArgument (f'{ user_or_role } is not a valid role.' )
330369
331370 if str (thread .id ) not in self .bot .config ['subscriptions' ]:
332371 self .bot .config ['subscriptions' ][str (thread .id )] = []
@@ -350,24 +389,24 @@ async def subscribe(self, ctx, *, role: Union[discord.Role, str.lower, None] = N
350389 @commands .command (aliases = ['unsub' ])
351390 @checks .has_permissions (PermissionLevel .SUPPORTER )
352391 @checks .thread_only ()
353- async def unsubscribe (self , ctx , * , role = None ):
392+ async def unsubscribe (self , ctx , * , user_or_role : Union [ discord . Role , User , str . lower , None ] = None ):
354393 """
355- Unsubscribe a role or yourself from a thread.
394+ Unsubscribe a user, role, or yourself from a thread.
356395
357- Leave `role ` empty to unsubscribe yourself.
396+ Leave `user_or_role ` empty to unsubscribe yourself.
358397 `@here` and `@everyone` can be substituted with `here` and `everyone`.
359- `role ` may be a role ID, mention, name, "everyone", or "here".
398+ `user_or_role ` may be a user ID, mention, name, role ID, mention, name, "everyone", or "here".
360399 """
361400 thread = ctx .thread
362401
363- if not role :
402+ if user_or_role is None :
364403 mention = ctx .author .mention
365- elif role .lower () in ('here' , 'everyone' ):
366- mention = '@' + role
404+ elif hasattr (user_or_role , 'mention' ):
405+ mention = user_or_role .mention
406+ elif user_or_role in {'here' , 'everyone' , '@here' , '@everyone' }:
407+ mention = '@' + user_or_role .lstrip ('@' )
367408 else :
368- converter = commands .RoleConverter ()
369- role = await converter .convert (ctx , role )
370- mention = role .mention
409+ mention = f'`{ user_or_role } `'
371410
372411 if str (thread .id ) not in self .bot .config ['subscriptions' ]:
373412 self .bot .config ['subscriptions' ][str (thread .id )] = []
0 commit comments