TypeError - currency.set is not a function

getting this error when using the DJS currency system guide, if anyone can help, it would be greatly appreciated <3 the part of the code that is throwing the error:
client.once(Events.ClientReady, async () => {
console.log("BOTN Market is online! WOOO");
client.user.setActivity("/help | updating...");
const storedBalances = await users.findAll();
storedBalances.forEach(b => currency.set(b.user_id, b));
});
client.once(Events.ClientReady, async () => {
console.log("BOTN Market is online! WOOO");
client.user.setActivity("/help | updating...");
const storedBalances = await users.findAll();
storedBalances.forEach(b => currency.set(b.user_id, b));
});
2 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Wicked ↝ 💊Ⅶ✥
the error stack:
node:events:505
throw er; // Unhandled 'error' event
^

TypeError: currency.set is not a function
at C:\Users\Felix\BOTNM\index.js:41:39
at Array.forEach (<anonymous>)
at Client.<anonymous> (C:\Users\Felix\BOTNM\index.js:41:17)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:384:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
node:events:505
throw er; // Unhandled 'error' event
^

TypeError: currency.set is not a function
at C:\Users\Felix\BOTNM\index.js:41:39
at Array.forEach (<anonymous>)
at Client.<anonymous> (C:\Users\Felix\BOTNM\index.js:41:17)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:384:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
this has me stumped. it was working perfectly about 15 minutes ago and i quite literally changed a bit of a message it was supposed to reply with, which somehow broke two whole commands- ;-; my node and npm version are the latest, as well gotcha [email protected] Node.js v18.2.0 i defined it in a separate './currency.js' file, using const currency = new Collection(); and exported it from there, then required it in necessary files export: module.exports = { addBalance, getBalance, currency }; imports: const currency = require('./currency'); will do, thank you for the help ^^
Want results from more Discord servers?
Add your server