Ok so basically its showing me an Error that property of fetch dosent exist i am using the replit database for a balance command (discord.js) Error Image
Here is the command file:
const { match } = require("../functions.js") const Database = require("@replit/database") const ms = require('pretty-ms') const db = new Database() module.exports = { name: 'balance', description: 'ping cmd', permissions: [], aliases: ['bal'], async execute(client, message, args, Discord) { let user = message.mentions.users.first() || client.users.cache.get(args[0]) || match(args.join(" ").toLowerCase(), message.guild) || message.author; let bal = await client.db.fetch(`money_${message.guild.id}_${user.id}.pocket`); if (bal === null) bal = 0; let bank = await client.db.fetch(`money_${message.guild.id}_${user.id}.bank`); if (bank === null) bank = 0; let TotalMoney = bank + bal; let moneyEmbed = new Discord.MessageEmbed() .setColor("#FFFFFF") .setDescription(`**${user}'s Balance**n **Pocket:** ${bal} **Bank:** ${bank} **Total:** ${TotalMoney}`); message.channel.send(moneyEmbed) } }
So how do I fix the error
Thanks In advance
Advertisement
Answer
Well client.db does not exist, this is what your error message is telling you. I am suggesting you to read the docs https://www.npmjs.com/package/@replit/database
The fix:
let bal = await db.get(`money_${message.guild.id}_${user.id}.pocket`);