targetchannel.send is not a function
await client.guilds.cache.map(guild => {
guild.channels.cache.forEach(async channel => {
try {
const targetchannel = client.channels.cache.get(channel.id);
if (targetchannel.permissionsFor(client.user).has("SEND_MESSAGES")) {
await targetchannel.send(messageContent)
nmsgsend = nmsgsend + 1
}
} catch (e) {
console.log(e);
}
});
});await client.guilds.cache.map(guild => {
guild.channels.cache.forEach(async channel => {
try {
const targetchannel = client.channels.cache.get(channel.id);
if (targetchannel.permissionsFor(client.user).has("SEND_MESSAGES")) {
await targetchannel.send(messageContent)
nmsgsend = nmsgsend + 1
}
} catch (e) {
console.log(e);
}
});
});that give error
targetchannel.send is not a functiontargetchannel.send is not a function, why ?