S
S
sheenon2021-05-19 20:45:10
Node.js
sheenon, 2021-05-19 20:45:10

I'm writing a Discord bot in JS. I'm using mongodb and I get an error when saving, how can I fix it?

const Discord = require("discord.js");
const embed = new Discord.MessageEmbed();
const User = require('../data/user');
const guild = require('../data/guild');

module.exports.run = async(bot, message, args) => {
    let coinemoji = bot.emojis.cache.find(e => e.name === "M_cash")

    if (!message.member.roles.cache.get("796669760665419786")) {
        return message.channel.send(embed
            .setColor(message.member.displayHexColor)
            .setDescription(`У вас нет прав на данную команду.`))
    }
    else
            guild.moneyOfPick = (args[0])
            message.channel.send(embed.setColor("BLUE")
            .setDescription(`Бот скинул бонус в размере ${guild.moneyOfPick} ${coinemoji}, напиши .pick что бы получить!`)).then(msg => {
            global.MessageByBot = msg.id;
            })
            guild.pickMsgs += 1;
            guild.save();
        }

module.exports.help = {
    name: "cpick",
}

Changed guild > Guild, but still didn't help.
jq35hAL.png
Error in the logs
If you need information - I'm waiting for clarifications.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MorganDusty, 2021-05-23
@MorganDusty

What is GUILD.save? They write to you that GUILD.SAVE is not a function for you, see the code, and in particular SAVE and edit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question