Series of component interactions

I have a flow in which I need a user to start with a context menu command, then I display a select menu with a set of categories, then display a set of roles based on the category selection, then add the role to the member the context command was used on.

I was working on using collectors to do this, and I can get through the first one without issue, but I cant figgure out how to do the second menu succesfully.

response.resource.message
                .awaitMessageComponent({
                    filter: collectorFilter,
                    time: 60_000,
                })
                .then(async (result) => {
                    await safeTry(result.deferUpdate());
                    if (!result.isStringSelectMenu()) return;
                    const term = result.values[0] ?? '';
                    const [classMenuError, response] = await safeTry(
                        interaction.editReply({
                            content: 'Select a class to add',
                            components: [buildClassSelectMenu(term, termGroupedRoles)],
                            flags: MessageFlags.Ephemeral,
                            withResponse: true,
                        }),
                    );


I need help either getting this to work, or advice on a better setup. Normally I handle all interactions using the custom_id in an interaction handler, rather than with these collectors, but in this case I need the id of the member that the command was run on at the end of these menus and I am not sure how I would achieve that without the collector setup.
Was this page helpful?