Collector

collector.on('collect', async i => {
    const selected = i.values[0];
    await i.update(`You selected ${selected}!`)
    if (selected === 'DM') {
        await i.editReply({content: 'The prompt has been sent to your DMs. Please continute there.', components: [] })
        const DMMsg = await i.user.send('bla').catch(async (err) => { return await i.editReply('I was unable to send you a Direct Message. Please ensure you have your DMs enabled.')})
    } else if (selected === 'S') {
        await i.editReply('nice work!');
    }
});
    collector.on('end', collected => {
        console.log(`Collected ${collected.size} interactions.`);
    });
    
    const DMcollector = DMMsg.createMessageComponentCollector({ componentType: ComponentType.StringSelect, time: 15000 })
Was this page helpful?