我的经济命令出错了,你能帮帮我吗?

时间:2021-07-18 13:24:03

标签: javascript node.js discord.js

你好,我一直试图解决我的经济命令的问题,我认为这是因为一个包出错了,有人能帮我吗?

const ms = require('parse-ms')

module.exports = {
    name: "daily",
    description: "Receive a daily award of money",

    async run (client, message, args) {
        let user = message.author;
        let timeout = 864; //86400000
        let amount = Math.floor(Math.random() * 5000) + 1;
        let daily = await db.fetch(`daily_${message.guild.id}_${user.id}`);

        if(daily !== null && timeout - (Date.now() - daily) > 0){
            let time = ms(timeout - (Date.now() - daily));

            return message.channel.send(`${message.author}, Você esta pegando seu daily rapido demais!!, seu proximo daily serâ em: ${time.days}d, ${time.hours}h, ${time.minutes}m, and ${time.seconds}s`)
            //{time.days}d, ${time.hours}h, ${time.minutes}m, and ${time.seconds}s
        } else {
            db.add(`money_${user.id}`, amount);
            db.set(`daily_${message.guild.id}_${user.id}`, Date.now());

            message.channel.send(`Seu daily foi adicionado a sua conta!!, Agora você tem ${amount} coins Na sua conta!!`)
        }
    }
}

控制台:

require() of ES modules is not supported.
require() of /home/runner/FastMC-2/node_modules/parse-ms/index.js from /home/runner/FastMC-2/commands/diario.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/runner/FastMC-2/node_modules/parse-ms/package.json.```

0 个答案:

没有答案
相关问题