@@ -674,20 +674,40 @@ async def ping(self, ctx):
674
674
675
675
@commands .command ()
676
676
@checks .has_permissions (PermissionLevel .ADMINISTRATOR )
677
- async def mention (self , ctx , * mention : Union [discord .Role , discord .Member ]):
677
+ async def mention (self , ctx , * mention : Union [discord .Role , discord .Member , str ]):
678
678
"""
679
679
Change what the bot mentions at the start of each thread.
680
680
681
681
Type only `{prefix}mention` to retrieve your current "mention" message.
682
+ `{prefix}mention disable` to disable mention.
683
+ `{prefix}mention reset` to reset it to default value.
682
684
"""
683
- # TODO: ability to disable mention.
684
685
current = self .bot .config ["mention" ]
685
-
686
686
if not mention :
687
687
embed = discord .Embed (
688
688
title = "Current mention:" , color = self .bot .main_color , description = str (current )
689
689
)
690
+ elif (
691
+ len (mention ) == 1
692
+ and isinstance (mention [0 ], str )
693
+ and mention [0 ].lower () in ["disable" , "reset" ]
694
+ ):
695
+ option = mention [0 ].lower ()
696
+ if option == "disable" :
697
+ embed = discord .Embed (
698
+ description = f"Disabled mention on thread creation." , color = self .bot .main_color ,
699
+ )
700
+ self .bot .config ["mention" ] = None
701
+ else :
702
+ embed = discord .Embed (
703
+ description = "`mention` is reset to default." , color = self .bot .main_color ,
704
+ )
705
+ self .bot .config .remove ("mention" )
706
+ await self .bot .config .update ()
690
707
else :
708
+ for m in mention :
709
+ if not isinstance (m , (discord .Role , discord .Member )):
710
+ raise commands .BadArgument (f'Role or Member "{ m } " not found.' )
691
711
mention = " " .join (i .mention for i in mention )
692
712
embed = discord .Embed (
693
713
title = "Changed mention!" ,
0 commit comments