Skip to content

Commit

Permalink
Raise errors before attempting to throttle
Browse files Browse the repository at this point in the history
  • Loading branch information
breqdev committed Apr 28, 2022
1 parent 672512e commit 96e339a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flask_discord_interactions/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ def update_commands(self, app=None, guild_id=None):
response = requests.put(
url, json=overwrite_data, headers=self.auth_headers(app)
)
self.throttle(response)

try:
response.raise_for_status()
Expand All @@ -414,6 +413,8 @@ def update_commands(self, app=None, guild_id=None):
f"{response.status_code} {response.text}"
)

self.throttle(response)

for command in response.json():
if command["name"] in app.discord_commands:
app.discord_commands[command["name"]].id = command["id"]
Expand All @@ -428,7 +429,6 @@ def update_commands(self, app=None, guild_id=None):
json={"permissions": command.dump_permissions()},
headers=self.auth_headers(app),
)
self.throttle(response)

try:
response.raise_for_status()
Expand All @@ -438,6 +438,8 @@ def update_commands(self, app=None, guild_id=None):
f"{response.status_code} {response.text}"
)

self.throttle(response)

def update_slash_commands(self, *args, **kwargs):
"""
Deprecated! As of v1.1.0, ``update_slash_commands`` has been renamed to
Expand Down

0 comments on commit 96e339a

Please sign in to comment.