Discord.js/Cron - 在特定时间发送多条消息

时间:2021-04-13 14:50:39

标签: javascript discord.js

我希望我的机器人在一天中的特定时间以特定的延迟发送特定数量的消息,并每天重复发送。我知道这涉及到 Cron 的使用,但我在实现它时遇到了一些困难。

const Discord = require('discord.js');
const bot = new Discord.Client();
const reactionEmoji = message.guild.emojis.cache.find(emoji => emoji.name === '7c2gaheiowu31compressed');
const clientPY = '7xxx45076137459732'

bot.on('message', (message) => {
    const mentionedMembersCollection = message.mentions.members;
    if (message.content.includes('play') || message.content.includes('time')) {
        
        message.react(reactionEmoji);

        const reply = ['No', 'You know? you will get sick', 'You really should stop']
        const show = reply[Math.floor(Math.random() * reply.length)];

        message.send(show)
    }

    if (mentionedMembersCollection.has('4xxx56331777245185') || 
            mentionedMembersCollection.has('70xxx2119722278943')) {
        if (message.author.id === clientPY) {
            message.channel.send('hello')
        }
    }
});

bot.login('ODI1MTxxxxxxxx1NzI4.YF5FAg.3bim466DN7HT_Ixxxxxxxxxxx');

0 个答案:

没有答案
相关问题