From 42d7636fc6653b8ffb6dc134ca8f174a1b11ecb1 Mon Sep 17 00:00:00 2001 From: PandaGuerrier <76222146+PandaGuerrier@users.noreply.github.com> Date: Sat, 22 Apr 2023 16:46:22 +0200 Subject: [PATCH] Fix late initialization error --- .../packets/interaction_create_packet.dart | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/src/internal/websockets/packets/interaction_create_packet.dart b/lib/src/internal/websockets/packets/interaction_create_packet.dart index 3a238f332..ac092eaad 100644 --- a/lib/src/internal/websockets/packets/interaction_create_packet.dart +++ b/lib/src/internal/websockets/packets/interaction_create_packet.dart @@ -135,27 +135,24 @@ class InteractionCreatePacket with Container implements WebsocketPacket { } catch(_) { } } - late dynamic interaction; if (payload['data']['component_type'] == ComponentType.dynamicSelect.value) { - interaction = DynamicMenuCreateEvent(DynamicMenuInteraction.from(payload)); + eventService.controller.add(DynamicMenuCreateEvent(DynamicMenuInteraction.from(payload))); } if (payload['data']['component_type'] == ComponentType.userSelect.value) { - interaction = UserMenuCreateEvent(UserMenuInteraction.from(payload)); + eventService.controller.add(UserMenuCreateEvent(UserMenuInteraction.from(payload))); } if (payload['data']['component_type'] == ComponentType.channelSelect.value) { - interaction = ChannelMenuCreateEvent(ChannelMenuInteraction.from(payload)); + eventService.controller.add(ChannelMenuCreateEvent(ChannelMenuInteraction.from(payload))); } if (payload['data']['component_type'] == ComponentType.roleSelect.value) { - interaction = RoleMenuCreateEvent(RoleMenuInteraction.from(payload)); + eventService.controller.add(RoleMenuCreateEvent(RoleMenuInteraction.from(payload))); } if (payload['data']['component_type'] == ComponentType.mentionableSelect.value) { - interaction = MentionableMenuCreateEvent(MentionableMenuInteraction.from(payload)); + eventService.controller.add(MentionableMenuCreateEvent(MentionableMenuInteraction.from(payload))); } - - eventService.controller.add(interaction); } }