经济购买 (Set) 金额 Discord.js

时间:2021-07-12 12:02:44

标签: javascript mongodb mongoose discord.js

所以我想改变我的机器人购买东西的方式,因为我将它设置为只购买 1 个特定数量,所以我选择让 args 参与进来。现在这样做,当我尝试做 -buybait 1 时,它说我没有金币可以这样做,但我这样做了……诱饵成本为 10,而我的个人资料上有 100,因此我尝试将其更改为 if "" "" <= "11" 然后说你没有正确数量的金币,但没有用

const profileModel = require("../../models/profileSchema");
const bagModel = require("../../models/bagSchema")
module.exports = {
  name: "buybait",
  aliases: ["buybait", "1","2","3","4","5","6","7","8","9","10"],
  permissions: [],
  description: "Shop",
  async execute(client, message, args, Discord, profileData, bagData) {

    if(args == "1"){
    const targetmoney = await profileModel.findOne({ vgbucks: "" });
    if (targetmoney <= 11) return message.channel.send("You Dont Have Enough Gold To Make This Purchase");
    try {
        await profileModel.findOneAndUpdate(
        {
          userID: message.author.id,
        },
        {
          $inc: {
            vgbucks: -10,
          },
        } );
          await bagModel.findOneAndUpdate(
          {
            userID: message.author.id,
          },
          {
            $inc: {
              bait: 1,
            },
          } );
        return message.channel.send(`This player Has Purchased 1 Fishing Bait`);
    } catch (err) {
      console.log(err);
    }

  }
}
,
}

The Bots Reaction On Command

0 个答案:

没有答案