How do i layout intents? This clearly doesn't work but idk what does (im new to discord.js)
const scheduleJob = require('node-schedule');
const client = new Discord.Client()
client.intents.add([
Discord.Intents.GUILDS,
Discord.Intents.GUILD_MESSAGES
]);
// replace '<DISCORD_BOT_TOKEN>' with your bot's token
client.login('CENSORED');
// an array to store the IDs of the channels to send the message to
const channels = [];
// create a schedule to send the message every hour
const sendMessageJob = scheduleJob('0 * * * *', () => {
// replace '<MESSAGE>' with the message you want to send
const message = 'https://soggycateveryhourbot.files.wordpress.com/2022/07/thesoggycat.jpg';
channels.forEach(channelId => {
const channel = client.channels.get(channelId);
if (channel) {
channel.send(message);
}
});
});
client.on('message', message => {
// only handle commands that start with '!addchannel' or '!removechannel'
if (message.content.startsWith('!addchannel') || message.content.startsWith('!removechannel')) {
// use the 'Message#command' method to parse the command and its arguments
const [command, channelId] = message.command();
if (command === 'addchannel' && channelId) {
// add the channel ID to the list of channels to send the message to
channels.push(channelId);
} else if (command === 'removechannel' && channelId) {
// remove the channel ID from the list of channels to send the message to
const index = channels.indexOf(channelId);
if (index >= 0) {
channels.splice(index, 1);
}
}
}
});