Browse Source

Fix scheduled event dispatch arguments

pull/7611/head
z03h 3 years ago
committed by GitHub
parent
commit
3300f12dbb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      discord/state.py

10
discord/state.py

@ -1317,7 +1317,7 @@ class ConnectionState:
if guild is not None:
scheduled_event = ScheduledEvent(state=self, data=data)
guild._scheduled_events[scheduled_event.id] = scheduled_event
self.dispatch('scheduled_event_create', guild, scheduled_event)
self.dispatch('scheduled_event_create', scheduled_event)
else:
_log.debug('SCHEDULED_EVENT_CREATE referencing unknown guild ID: %s. Discarding.', data['guild_id'])
@ -1328,7 +1328,7 @@ class ConnectionState:
if scheduled_event is not None:
old_scheduled_event = copy.copy(scheduled_event)
scheduled_event._update(data)
self.dispatch('scheduled_event_update', guild, old_scheduled_event, scheduled_event)
self.dispatch('scheduled_event_update', old_scheduled_event, scheduled_event)
else:
_log.debug('SCHEDULED_EVENT_UPDATE referencing unknown scheduled event ID: %s. Discarding.', data['id'])
else:
@ -1342,7 +1342,7 @@ class ConnectionState:
except KeyError:
pass
else:
self.dispatch('scheduled_event_delete', guild, scheduled_event)
self.dispatch('scheduled_event_delete', scheduled_event)
else:
_log.debug('SCHEDULED_EVENT_DELETE referencing unknown guild ID: %s. Discarding.', data['guild_id'])
@ -1354,10 +1354,9 @@ class ConnectionState:
user = self.get_user(int(data['user_id']))
if user is not None:
scheduled_event._add_user(user)
self.dispatch('scheduled_event_user_add', guild, scheduled_event, user)
self.dispatch('scheduled_event_user_add', scheduled_event, user)
else:
_log.debug('SCHEDULED_EVENT_USER_ADD referencing unknown user ID: %s. Discarding.', data['user_id'])
self.dispatch('scheduled_event_user_add', guild, scheduled_event, user)
else:
_log.debug(
'SCHEDULED_EVENT_USER_ADD referencing unknown scheduled event ID: %s. Discarding.',
@ -1377,7 +1376,6 @@ class ConnectionState:
self.dispatch('scheduled_event_user_remove', scheduled_event, user)
else:
_log.debug('SCHEDULED_EVENT_USER_REMOVE referencing unknown user ID: %s. Discarding.', data['user_id'])
self.dispatch('scheduled_event_user_remove', scheduled_event, user)
else:
_log.debug(
'SCHEDULED_EVENT_USER_REMOVE referencing unknown scheduled event ID: %s. Discarding.',

Loading…
Cancel
Save