我一直在尝试让!rob命令在我的discord机器人上工作一段时间,但是它总是忽略let authorBal = db.fetch(`money_${message.guild.id}_${message.author.id}`);
之后和''const embed = new Discord.MessageEmbed()
.setTitle(${author.username} just robbed ${user.username} for ${random} coins!
)
.setDescription(Unlucky ${user.username}
);
db.add(money_${message.guild.id}_${user.id}
,随机);
db.subtract(money_${message.guild.id}_${user.id}
,随机)
message.channel.send(embed)```这是完整的代码请帮助
const db = require('quick.db')
const Discord = require('discord.js');
module.exports = {
name:"rob",
description:"rob someone!",
async run(client, message, args) {
let user = message.mentions.users.first();
let fine = Math.floor(Math.random() * 100) + 1;
let random = Math.floor(Math.random() * 100) + 1;
if(!user)return message.channel.send('Please metion who you want to rob')
let author = message.author;
if(author === user) return message.channel.send('you can\'t rob yourself')
let authorBal = db.fetch(`money_${message.guild.id}_${message.author.id}`);
if(author < 100) return message.channel.send(':x: You need at least 100 coins to rob someone')
let userBal = db.fetch(`money_${message.guild.id}_${user.id}`);
if(userBal = 0 ) {
message.channel.send('You just tried to rob a poor person! :angry:')
db.subtract(`money_${message.guild.id}_${user.id}`, fine);
return;
}
const embed = new Discord.MessageEmbed()
.setTitle(`${author.username} just robbed ${user.username} for ${random} coins!`)
.setDescription(`Unlucky ${user.username}`);
db.add(`money_${message.guild.id}_${user.id}`, random);
db.subtract(`money_${message.guild.id}_${user.id}`, random)
message.channel.send(embed)
}}