Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
TypeError: Cannot Read function of 'fetch' of undefined (discord.js)

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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`);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!