获取未定义的发送

时间:2017-11-06 18:01:12

标签: javascript node.js sqlite discord

让代码正常工作,但遇到了一个小问题。什么时候打印

${this.lastID.creator}$,${this.lastID.Team1}$,${this.lastID.Team2}$. 

它是未定义的!

它们被打印为未定义。同时它在数据库中正确保存。我该怎么做或改变?提前谢谢!

     c=config.slots.length;while(c)b=Math.random()*c--|0,d=config.slots[c],config.slots[c]=config.slots[b],config.slots[b]=d
     var db = new sqlite3.Database('Matches');
     var dt = new Date();
     var n = dt.toLocaleTimeString();
     db.run(`INSERT INTO Match VALUES(?,?,?,?,?)`, [`${config.slots[0]}, ${config.slots[1]}, ${config.slots[2]} |`, ` ${config.slots[3]}, ${config.slots[4]}, ${config.slots[5]} |`, "  |", n , ` ${config.creator[0]}`], function(err) {
         if (err) {
          return console.log(err.message);
         }             // get the last insert id
         console.log(`A row has been inserted with rowid ${this.lastID}`);
         message.channel.send({embed: {
             color: 3447003,
             title: "Game has started!",
             fields: [{
                 name: `Match Lobby #${this.lastID} creator:`,
                 value: `${this.lastID.creator}`
               },
               {
                 name: "**Team 1:**",
                 value: `${this.lastID.Team1}`
               },
               {
                 name: "**Team 2:**",
                 value: `${this.lastID.Team2}`
               }
             ],
           }
         });
       });

0 个答案:

没有答案