Basically, I am trying to create a discord.js/quick.db economy system and I tried making a simple balance command, using a tutorial for guidance, and this command won't execute, but no errors are showing in the logs.
I tried researching how to do it, following other tutorials, but it just leads me back to this error. I have already installed all the required packages for this.
const Discord = require('discord.js')
const db = require('quick.db')
module.exports.run = async (bot, message, args) => {
let bal = db.fetch(`money_${message.guild.id}_${message.author.id}`)
if (bal === null) bal = 0;
message.channel.send('You have a balance of `' + bal + '`')
}
I am receiving no errors, but the command just won't execute, I even searched the logs to make sure there were absolutely no errors, but nothing is showing up.
I have a similar script and mines working, I didn't use
if (bal === null) bal = 0
My code is this:
let goldAmount = db.get(`money_${message.author.id}`)
let balEmbed = new Discord.RichEmbed()
.setTitle(`${message.author.username}'s Gold`)
.setColor([0,200,20])
.setDescription(`${goldAmount} Gold`)
await message.channel.send(balEmbed);
You don't need to send it as a RichEmbed, you can just do await message.channel.send(goldAmount);
This works for me!
let user = message.mentions.members.first() || message.author;
let bal = db.fetch(`money_${message.guild.id}_${user.id}`)
if (bal === null) bal = 0;
let bank = await db.fetch(`bank_${message.guild.id}_${user.id}`)
if (bank === null) bank = 0;
let moneyEmbed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setDescription(`**${user}'s Balance**\n\n__Pocket:__${bal}\n__Bank:__${bank}\n__Overall:__ ${bank + bal}`);
message.channel.send(moneyEmbed);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.