Skip to content

Commit

Permalink
Prevent duplicate integration application creation in application com…
Browse files Browse the repository at this point in the history
…mand handling
  • Loading branch information
dolfies committed Sep 10, 2023
1 parent fd240be commit 4f2a6df
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ async def _handle_commands(
prev_cursor = cursor
cursor = data['cursor'].get('next')
cmds = data['application_commands']
apps = {int(app['id']): app for app in data.get('applications') or []}
apps = {int(app['id']): state.create_integration_application(app) for app in data.get('applications') or []}

for cmd in cmds:
# Handle faked parameters
Expand All @@ -280,9 +280,7 @@ async def _handle_commands(
except ValueError:
pass

application_data = apps.get(int(cmd['application_id']))
application = state.create_integration_application(application_data) if application_data else None

application = apps.get(int(cmd['application_id']))
yield cls(state=state, data=cmd, channel=channel, target=target, application=application)

cmd_ids = None
Expand Down

0 comments on commit 4f2a6df

Please sign in to comment.