Closed tanjiro-habshi closed 4 months ago
You can't just throw (poorly formatted) code in here and expect someone else to fix bugs for you. I'm certain that this is not a bug in better-sqlite3 but a user error. For all I know your code doesn't even use better-sqlite3 at all.
I want to point out that the Database
class does indeed not have a get
method. Assuming db
even is an instance of Database
, how would I know?
This code was working before even without better-sqlite3 but I don't know it has suddenly stopped working however i checked and browsed through docs.
What do you mean by "This code was working before even without better-sqlite3"?
As far as I understand quick.db, the package you are importing db from, is more or less a wrapper for several different database drivers, that just recommends better-sqlite3 as a default.
And if you are really just doing this
const db = require("quick.db");
...
db.get(...)
This call to get will throw an expected error, as "db" is not a usable instance of a database. As shown within the minimal example in the quick.db repo you have to create a new quick.db instance
const { QuickDB } = require("quick.db");
const db = new QuickDB();
...
Turns out my code wasn't optimized for quick.db, I fixed it now.
On Fri, Mar 1, 2024, 1:03 AM neoxpert @.***> wrote:
What do you mean by "This code was working before even without better-sqlite3"?
As far as I understand quick.db https://github.com/plexidev/quick.db, the package you are importing db from, is more or less a wrapper for several different database drivers, that just recommends better-sqlite3 as a default.
And if you are really just doing this
const db = require("quick.db"); ...db.get(...)
This call to get will throw an expected error, as "db" is not a usable instance of a database. As shown within the minimal example in the quick.db repo you have to create a new quick.db instance
const { QuickDB } = require("quick.db");const db = new QuickDB(); ...
— Reply to this email directly, view it on GitHub https://github.com/WiseLibs/better-sqlite3/issues/1152#issuecomment-1971867356, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGHKJ2IWLALMXFHYXYJWVLYV6EQPAVCNFSM6AAAAABD5OBY7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZRHA3DOMZVGY . You are receiving this because you authored the thread.Message ID: @.***>
Hi i coded a discord bot's command but it doesnt seem to work because of this error TypeError: db.get is not a function my code for index.js to send and randomize pfps: client.on("ready", async () => { const randompfp = async () => { try { const avatar = client.users.cache.filter(user => user.avatarURL()).random().avatarURL({ size: 1024, dynamic: true });
};
setInterval(randompfp, 20 * 1000); // Adjust the interval as needed });
my code for autopfp set and clear through users: const Discord = require("discord.js"); const db = require("quick.db"); const config = require("../../config") const { warn } = require('../../emojis.json') const { approve } = require('../../emojis.json') const { mark } = require('../../emojis.json') const { green } = require('../../color.json') const { red } = require('../../color.json') const { yellow } = require('../../color.json') const { PREFIX } = require('../../config');
module.exports = { config: { name: "autopfp", aliases: ["autopfp", "ap", "af"] }, run: async (client, message, args) => { const developers = ['984093615510933544', '190287212615696384'];
} };