@@ -946,6 +946,14 @@ class ContextMenuCommand(ApplicationCommand):
946
946
The coroutine that is executed when the command is called.
947
947
guild_ids: Optional[List[:class:`int`]]
948
948
The ids of the guilds where this command will be registered.
949
+ default_permission: :class:`bool`
950
+ Whether the command is enabled by default when it is added to a guild.
951
+ permissions: List[:class:`.Permission`]
952
+ The permissions for this command.
953
+
954
+ .. note::
955
+ If this is not empty then default_permissions will be set to ``False``.
956
+
949
957
cog: Optional[:class:`Cog`]
950
958
The cog that this command belongs to. ``None`` if there isn't one.
951
959
checks: List[Callable[[:class:`.ApplicationContext`], :class:`bool`]]
@@ -990,8 +998,10 @@ def __init__(self, func: Callable, *args, **kwargs) -> None:
990
998
991
999
self .validate_parameters ()
992
1000
993
- # Context Menu commands don't have permissions
994
- self .permissions = []
1001
+ self .default_permission = kwargs .get ("default_permission" , True )
1002
+ self .permissions : List [Permission ] = getattr (func , "__app_cmd_perms__" , []) + kwargs .get ("permissions" , [])
1003
+ if self .permissions and self .default_permission :
1004
+ self .default_permission = False
995
1005
996
1006
# Context Menu commands can't have parents
997
1007
self .parent = None
@@ -1034,7 +1044,7 @@ def qualified_name(self):
1034
1044
return self .name
1035
1045
1036
1046
def to_dict (self ) -> Dict [str , Union [str , int ]]:
1037
- return {"name" : self .name , "description" : self .description , "type" : self .type }
1047
+ return {"name" : self .name , "description" : self .description , "type" : self .type , "default_permission" : self . default_permission }
1038
1048
1039
1049
1040
1050
class UserCommand (ContextMenuCommand ):
0 commit comments