I keep getting the error TypeError: Cannot read property 'channel' of undefined
const messageChannel = cheese.channel.cache.get("796750832305307719");
Here's my code:
const Discord = require('discord.js');
const { Client, Intents, Guild, channels } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const cron = require('node-cron');
const express = require('express');
require('dotenv').config;
const channel = require('discord.js')
const { TextChannel } = require('discord.js')
const cheese = client.guilds.cache.get("796750832305307716");
const messageChannel = cheese.channel.cache.get("796750832305307719");
try {
app = express();
cron.schedule('* 24 18 * * *', function() {
client.login('token').then(() =>{
console.log("I am ready");
messageChannel.send("TEST").then(() => client.destroy());
})
});
app.listen(3000);
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment