0

I was programming a discordjs bot with my friends, when we decided to make a gameboard. Basically, its a channel in which every message that gets 2 :video_game: reactions gets put there (Like 'best messages'). However, there is a problem and I can't seem to fix it. Here is my code:

client.on('messageReactionAdd', (reaction, user) => {
  if (user.bot) return;
  console.log(reaction);

  if (reaction.emoji.name == '') {
    if (reaction.count == 2) {
      if (db.has('gameboard') == false) {
        gameboard = db.table('gameboard');
      };
      if (db.get('gameboard', {id: reaction.author.id}) == null) {
        db.add('gameboard', {
          id: reaction.message.author.id,
          username: reaction.message.author.username,
          avatar: reaction.message.author.avatar,
          content: reaction.message.content
        });
      }
      msg = db.get('gameboard', {id: reaction.author.id});
      embed = new Discord.MessageEmbed()
        .setColor('RANDOM')
        .setDescription(message.content)
        .setAuthor(message.username, `https://cdn.discordapp.com/avatars/${msg.id}/${msg.author}.png?size=128`)
      client.channels.cache.get('813807201042169926').send(embed);
    };
  };
});

I already have QuickDB setup with the json.sqlite file. The whole code is open-source here.

John Conde
  • 217,595
  • 99
  • 455
  • 496

0 Answers0