0

I am still very new with coding so I follow tutorials and I'm currently trying to make a currency system and so I've been trying to follow this tutorial: https://youtu.be/PnXv-0RUdRI and one of the things that are in his code is import * as db from "quick.db"; however I got this error SyntaxError: Unexpected token * and I'm not sure how to change or fix it. I've looked everywhere but nothing makes sense to me.

This is the code that I've currently been following

        import * as db from "quick.db";
        import { isNull } from "util";


        let allUsers = client.users.array();
    for(let i = 0; i < allUsers.length; i++){

        if(isNull(db.get(allUsers[i].id))){

            db.set(allUsers[i].id, {money: 50, items: [] })
        }
    }


        if(isNull(db.get(member.id))){

        db.set(member.id, {money: 50, items: [] })
    }

I was expecting it to go just like the video where I start up the bot and I get a json.sqlite but instead I got a SyntaxError: Unexpected token *

Syntle
  • 5,168
  • 3
  • 13
  • 34

1 Answers1

0

If you're doing this on NodeJS JavaScript, then use: const db = require('quick.db');

If you're doing this on NodeJS Typescript, then first run this command on your terminal (ignore the dollar-sign, that just indicates that it's a command line command): $ npm i @types/quick.db and then in your code write: import db = require('db');

The Freeze
  • 271
  • 2
  • 5