Skip to content

Commit

Permalink
Merge pull request #101 from mineral-dart/fix/interaction
Browse files Browse the repository at this point in the history
Fix late initialization error
  • Loading branch information
PandaGuerrier authored Apr 23, 2023
2 parents 636d928 + 42d7636 commit ce4a4cc
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit ce4a4cc

Please sign in to comment.