Skip to content

Commit f1e0af7

Browse files
committed
Fixed bugs with manage_commands
1 parent b473a2c commit f1e0af7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

discord_slash/utils/manage_commands.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ async def get_all_guild_commands_permissions(bot_id,
165165
if not 200 <= resp.status < 300:
166166
raise RequestFailure(resp.status, await resp.text())
167167
return await resp.json()
168-
169-
async def get_guild_command_permissions(bot_id,
170-
bot_token,
171-
guild_id,
172-
command_id):
168+
169+
170+
async def get_guild_command_permissions(bot_id,
171+
bot_token,
172+
guild_id,
173+
command_id):
173174
"""
174175
A coroutine that sends a request to get a single command's permissions in guild
175176
176177
:param bot_id: User ID of the bot.
177178
:param bot_token: Token of the bot.
178179
:param guild_id: ID of the guild to update permissions on.
179180
:param command_id: ID for the command to update permissions on.
180-
:param permissions: List of permissions for the command.
181181
:return: JSON Response of the request. A list of <https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions>
182182
:raises: :class:`.error.RequestFailure` - Requesting to Discord API has failed.
183183
"""
@@ -187,7 +187,7 @@ async def get_guild_command_permissions(bot_id,
187187
if resp.status == 429:
188188
_json = await resp.json()
189189
await asyncio.sleep(_json["retry_after"])
190-
return await get_guild_command_permissions(bot_id, bot_token, guild_id)
190+
return await get_guild_command_permissions(bot_id, bot_token, guild_id, command_id)
191191
if not 200 <= resp.status < 300:
192192
raise RequestFailure(resp.status, await resp.text())
193193
return await resp.json()
@@ -216,13 +216,12 @@ async def update_single_command_permissions(bot_id,
216216
if resp.status == 429:
217217
_json = await resp.json()
218218
await asyncio.sleep(_json["retry_after"])
219-
return await update_single_command_permissions(bot_id, bot_token, guild_id, permissions)
219+
return await update_single_command_permissions(bot_id, bot_token, guild_id, command_id, permissions)
220220
if not 200 <= resp.status < 300:
221221
raise RequestFailure(resp.status, await resp.text())
222222
return await resp.json()
223223

224224

225-
226225
async def update_guild_commands_permissions(bot_id,
227226
bot_token,
228227
guild_id,
@@ -233,7 +232,7 @@ async def update_guild_commands_permissions(bot_id,
233232
:param bot_id: User ID of the bot.
234233
:param bot_token: Token of the bot.
235234
:param guild_id: ID of the guild to update permissions.
236-
:param permissions: List of dict with permissions for each commands.
235+
:param cmd_permissions: List of dict with permissions for each commands.
237236
:return: JSON Response of the request. A list of <https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions>.
238237
:raises: :class:`.error.RequestFailure` - Requesting to Discord API has failed.
239238
"""

0 commit comments

Comments
 (0)