I encountered an issue with the following error message:
TypeError: Cannot read property 'channel' of undefined
let channel = message.guild.channel.cache.find('830754717108797450')
Below is the code snippet in question:
const MinecraftCommand = require('../../contracts/MinecraftCommand')
const Discord = require('discord.js-light');
const { Message } = require('discord.js-light');
const ms = require('pretty-ms');
const client = require ('discord.js-light')
class GuildMemberReportCommand extends MinecraftCommand {
onCommand(username, message) {
let args = this.getArgs(message)
let reason = args[1];
let guild = message.guild.cache.get('')
let channel = message.guild.channel.cache.find('830754717108797450')
let reporteduser = args[0];
let embed = new Discord.MessageEmbed()
.setTitle("Guild Member Report!")
.addField("Reason", reason)
.addField("Reported By", username)
.addField("Reported User", reporteduser)
.setColor("#f49542")
if (!reason) return this.send('Report reason needs to be specified!', username);
if (!username) return this.send ('Reported member was not speified!', username);
this.send(`${username}, $args[0] has been reported!, Please be patient when staff checks your report!`)
channel.send(embed).then(i => i.react("⏳"))
}
}
module.exports = GuildMemberReportCommand