discord.js命令在嵌入消息的for statment之后不返回任何内容

h6my8fg2  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(128)

我正在尝试将sql查询返回到显示数据库结果的嵌入消息中。它不返回任何错误,但当我尝试console.log()时,它返回的变量为空。我的目的是返回一个单一的嵌入信息的“胶囊”成员与他的恐龙的地位。。。数据库中的行包括slot、characterclass和growth。
提前谢谢

let discid = message.author.id
       const capusles = db.prepare(
        `SELECT * FROM capsules WHERE discid=? ORDER BY SLOT DESC LIMIT 10`
      ).all(discid)

      let SlotN = '';
      let dinoN = '';
      let dGrowth = '';
      for (let i = 0; i < capusles.length; i++) {

        const data = capusles[i];
        const SLOT = (data.SLOT);

        SlotN += `\`${i + 1}\` ${row.SLOT}\n`; // Tried this...
        dinoN += `\`${data.row.CharacterClass}\`\n`; // and also tried this...
        dGrowth += `\`${data.row.Growth}\`\n`;

      }

      console.log(`Dino: ${SlotN}`)   // => Returns empyt
      console.log(`Dino1 ${dinoN}`)   // => Returns empyt
      console.log(`Dino2 ${dGrowth}`) // => Returns empyt

      /*const embed1 = new Discord.MessageEmbed()
        .setAuthor(`Capsules`)
        .setColor(0x51267)
        .addFields({ name: 'Capsules', value: SlotN, inline: true },
          { name: 'Dino', value: dinoN, inline: true },
          { name: 'Growth', value: dGrowth, inline: true });

      message.reply(embed1);*/
      return;

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题