0

So I want to store user reactions into quick.db

    let wembed = new Discord.MessageEmbed()
    .setAuthor("Armagedon RolePlay | Verify System")
    .setColor("PURPLE")
    .setThumbnail(message.author.displayAvatarURL())
    .setDescription(arg1) 

    const reactmessage = await client.channels.cache.get(chx).send(wembed)
    await reactmessage.react('✅');

    const filter = (reaction, user) => reaction.emoji.name === '✅' && !user.bot;
    const collector = reactmessage.createReactionCollector(filter, { time: 15000 });

    collector.on('collect', async reaction => {      
        const user = reaction.users.cache.last();
        const guild = reaction.message.guild;
        const member = guild.member(user) || await guild.fetchMember(user);
        member.roles.add("725747028323205170");
    });

Basically I want to store user's reaction then store it into quick.db in case bot crashes and reboots after on users can still react to wembed

rez
  • 311
  • 2
  • 17

1 Answers1

0

Storing into quick.db or any database isn't the best idea. If you want to get working with reactions after the bot crashed/reboot, use Client's options where it includes partials. I recommend use this code:

const client = new Discord.Client({
   partials: ['MESSAGE', 'CHANNEL', 'REACTION', "GUILD_MEMBER"]
})
Rulavi
  • 183
  • 5
  • Ye but still, if I reboot the bot users can still react to the message but won't get the role – rez Jun 30 '20 at 12:28
  • make sure you need to fetch a Member class like this `const member = message.guild.members.cache.get(user.id)` and then add it a role. – Rulavi Jun 30 '20 at 14:05
  • Hmm ye but is there a way of doing this in my command file not index.js – rez Jun 30 '20 at 14:17