我希望我的机器人在一天中的特定时间以特定的延迟发送特定数量的消息,并每天重复发送。我知道这涉及到 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');