Skip to content

Commit 94de0be

Browse files
authored
added docstrings to the has_any_role and is_user decos
1 parent ef19ab1 commit 94de0be

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

discord/commands/permissions.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,22 @@ def decorator(func: Callable):
136136
return decorator
137137

138138
def has_any_role(*items: Union[int, str], guild_id: int = None):
139+
"""The method used to specify multiple application command role restrictions,
140+
The application command runs if the invoker has **any** of the specified roles.
141+
142+
This method is meant to be used as a decorator.
143+
144+
.. versionadded:: 2.0
145+
146+
Attributes
147+
-----------
148+
*items: Union[:class:`int`, :class:`str`]
149+
The integers or strings that represent the ids or names of the roles
150+
that the permission is tied to.
151+
guild_id: :class:`int`
152+
The integer which represents the id of the guild that the
153+
permission may be tied to.
154+
"""
139155
def decorator(func: Callable):
140156
# Create __app_cmd_perms__
141157
if not hasattr(func, '__app_cmd_perms__'):
@@ -153,6 +169,20 @@ def decorator(func: Callable):
153169
return decorator
154170

155171
def is_user(user: int, guild_id: int = None):
172+
"""The method used to specify application command user restrictions.
173+
174+
This method is meant to be used as a decorator.
175+
176+
.. versionadded:: 2.0
177+
178+
Attributes
179+
-----------
180+
user: :class:`int`
181+
An integer that represent the id the user the permission is tied to.
182+
guild_id: :class:`int`
183+
The integer which represents the id of the guild that the
184+
permission may be tied to.
185+
"""
156186
def decorator(func: Callable):
157187
# Create __app_cmd_perms__
158188
if not hasattr(func, '__app_cmd_perms__'):

0 commit comments

Comments
 (0)