|
26 | 26 | from typing import Union, Dict, Callable
|
27 | 27 |
|
28 | 28 | __all__ = (
|
29 |
| - "Permission", |
| 29 | + "CommandPermission", |
30 | 30 | "has_role",
|
31 | 31 | "has_any_role",
|
32 | 32 | "is_user",
|
33 | 33 | "is_owner",
|
34 | 34 | "permission",
|
35 | 35 | )
|
36 | 36 |
|
37 |
| -class Permission: |
| 37 | +class CommandPermission: |
38 | 38 | """The class used in the application command decorators
|
39 | 39 | to hash permission data into a dictionary using the
|
40 | 40 | :meth:`to_dict` method to be sent to the discord API later on.
|
@@ -87,9 +87,9 @@ def permission(role_id: int = None, user_id: int = None, permission: bool = True
|
87 | 87 | """
|
88 | 88 | def decorator(func: Callable):
|
89 | 89 | if not role_id is None:
|
90 |
| - app_cmd_perm = Permission(role_id, 1, permission, guild_id) |
| 90 | + app_cmd_perm = CommandPermission(role_id, 1, permission, guild_id) |
91 | 91 | elif not user_id is None:
|
92 |
| - app_cmd_perm = Permission(user_id, 2, permission, guild_id) |
| 92 | + app_cmd_perm = CommandPermission(user_id, 2, permission, guild_id) |
93 | 93 | else:
|
94 | 94 | raise ValueError("role_id or user_id must be specified!")
|
95 | 95 |
|
@@ -126,7 +126,7 @@ def decorator(func: Callable):
|
126 | 126 | func.__app_cmd_perms__ = []
|
127 | 127 |
|
128 | 128 | # Permissions (Will Convert ID later in register_commands if needed)
|
129 |
| - app_cmd_perm = Permission(item, 1, True, guild_id) #{"id": item, "type": 1, "permission": True} |
| 129 | + app_cmd_perm = CommandPermission(item, 1, True, guild_id) #{"id": item, "type": 1, "permission": True} |
130 | 130 |
|
131 | 131 | # Append
|
132 | 132 | func.__app_cmd_perms__.append(app_cmd_perm)
|
@@ -159,7 +159,7 @@ def decorator(func: Callable):
|
159 | 159 |
|
160 | 160 | # Permissions (Will Convert ID later in register_commands if needed)
|
161 | 161 | for item in items:
|
162 |
| - app_cmd_perm = Permission(item, 1, True, guild_id) #{"id": item, "type": 1, "permission": True} |
| 162 | + app_cmd_perm = CommandPermission(item, 1, True, guild_id) #{"id": item, "type": 1, "permission": True} |
163 | 163 |
|
164 | 164 | # Append
|
165 | 165 | func.__app_cmd_perms__.append(app_cmd_perm)
|
@@ -189,7 +189,7 @@ def decorator(func: Callable):
|
189 | 189 | func.__app_cmd_perms__ = []
|
190 | 190 |
|
191 | 191 | # Permissions (Will Convert ID later in register_commands if needed)
|
192 |
| - app_cmd_perm = Permission(user, 2, True, guild_id) #{"id": user, "type": 2, "permission": True} |
| 192 | + app_cmd_perm = CommandPermission(user, 2, True, guild_id) #{"id": user, "type": 2, "permission": True} |
193 | 193 |
|
194 | 194 | # Append
|
195 | 195 | func.__app_cmd_perms__.append(app_cmd_perm)
|
@@ -218,7 +218,7 @@ def decorator(func: Callable):
|
218 | 218 | func.__app_cmd_perms__ = []
|
219 | 219 |
|
220 | 220 | # Permissions (Will Convert ID later in register_commands if needed)
|
221 |
| - app_cmd_perm = Permission("owner", 2, True, guild_id) #{"id": "owner", "type": 2, "permission": True} |
| 221 | + app_cmd_perm = CommandPermission("owner", 2, True, guild_id) #{"id": "owner", "type": 2, "permission": True} |
222 | 222 |
|
223 | 223 | # Append
|
224 | 224 | func.__app_cmd_perms__.append(app_cmd_perm)
|
|
0 commit comments