0

所以我试图为我的不和谐机器人创建一个预定的提醒,经过大量的修补,这就是我得到的。

const Discord = require("discord.js")
const cron = require("node-cron");
const bot = new Discord.Client({disableEveryone: False});

module.exports = bot => { 
    console.log(`${bot.user.username} is online`)
    bot.user.setActivity("SINoALICE", {type: "PLAYING"});

    let reminderChannel = client.channel.find(channel => channel.id === '731870214526074910');
    let colloseumChannel = client.channel.find(channel => channel.id ==='730423361783726111');

    const cronJobs = [
        { "type": "Guerrilla", "param": "* 25 20 * * *" },
        { "type": "Guerrilla", "param": "* 25 22 * * *" },
        { "type": "Guerrilla", "param": "* 25 00 * * *" },
        { "type": "Guerrilla", "param": "* 25 02 * * *" },
        { "type": "Guerrilla", "param": "* 25 04 * * *" },
        { "type": "Guerrilla", "param": "* 25 13 * * *" },
        { "type": "Conquest", "param": "* 25 21 * * *" },
        { "type": "Conquest", "param": "* 25 23 * * *" },
        { "type": "Conquest", "param": "* 25 01 * * *" },
        { "type": "Conquest", "param": "* 25 03 * * *" },
        { "type": "Conquest", "param": "* 25 05 * * *" },
        { "type": "Conquest", "param": "* 50 14 * * *" },
        { "type": "Colloseum", "param": "* 50 22 * * *" }
    ];
 
for(let i = 0; i < cronJobs.length; i++){
  cron.schedule(cronJobs[i].param, cronJobs[i] => {
    let message;
    if(cronJobs[i].type === 'Colloseum'){
        colloseumChannel.send(`@everyone The Colloseum Battle is about to being in 10 minutes. Please ready yourself!`);
     } else {
       reminderChannel.send(`@everyone The next ${croneJobs.[i].type} Event begins in 5 minutes.`);
     }
    console.log("Scheduler running...")
  })
}
}

但是我遇到了问题问题日志,我完全不知道我能做什么。有什么建议吗?

4

0 回答 0