Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js db.run不是一个函数:Discord.js sqlite_Node.js_Sqlite_Discord_Discord.js - Fatal编程技术网

Node.js db.run不是一个函数:Discord.js sqlite

Node.js db.run不是一个函数:Discord.js sqlite,node.js,sqlite,discord,discord.js,Node.js,Sqlite,Discord,Discord.js,所以我得到了一个错误,特别是“(node:9780)unhandledPromisejectionWarning:TypeError:db.run不是一个函数” 我不知道怎么回事,所以我想这里有人可以帮我 const Discord = require("discord.js"); const client = new Discord.Client(); const bot = new Discord.Client(); const sql = require("sqlite")

所以我得到了一个错误,特别是“(node:9780)unhandledPromisejectionWarning:TypeError:db.run不是一个函数” 我不知道怎么回事,所以我想这里有人可以帮我

  const Discord = require("discord.js");
  const client = new Discord.Client();
 const bot = new Discord.Client();
 const sql = require("sqlite")
  const db = sql.open('./database.sqlite', { Promise });

 const fs = require("fs");
 const staff = ["97122523086340096", "450241616331145217", "283438590875402240", "288755621787074560"]
 const config = require("./config.json");
client.on("ready", async () => {
   console.log(`${client.user.username} is ready to help servers!`)
   console.log ("Warning: I am being locally hosted. During high usage times, the bot may crash.")
    db.run("CREATE TABLE IF NOT EXISTS guild (guildId TEXT, language INTEGER, links INTEGER)");
   console.log(`I am available in 1 shard! I am in ${client.guilds.size} guilds and serving ${bot.users.size}`)
   client.user.setActivity("For sat!help", {type: "WATCHING"}, {status:"dnd"});
   client.user.setPresence( {status:"idle"} )
      });

     fs.readdir("./events/", (err, files) => {
     if (err) return console.error(err);
    files.forEach(file => {
    let eventFunction = require(`./events/${file}`);
     let eventName = file.split(".")[0];
     client.on(eventName, (...args) => eventFunction.run(client, ...args));
     });
     });

    client.on("message", message => {
        if (message.author.bot) return;
     if(message.content.indexOf(config.prefix) !== 0) return;
    const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
     const command = args.shift().toLowerCase();

    try {
     let commandFile = require(`./commands/${command}.js`);
     commandFile.run(bot, message, args);
     } catch (err) {
    return
     }
     });
      client.on("guildCreate", guild => {
      let guildp = guild.owner
        guildp.send("Thanks for adding me to your server! \n To save you some time I would suggest you run the command 'sat!setup' to create the nessecary roles and channels for the bot. \n Please note that the channel is not made with perms.\n ***[PLEASE NOTE!] - I am still in beta so any issues with any part of the bot please tell us with sat!bug! \n Thanks!")

   })
    client.login(config.token);
兑现诺言

来自NPM-:


我好像没有工作。现在我又犯了一个错误。。SyntaxError:await仅在异步函数@saddyReturn中有效,并在分配它的异步函数中返回它。异步函数数据库(){return awaittdbpromise}let db=database()
const dbPromise = sqlite.open('./database.sqlite', { Promise });
const db = await dbPromise;