sending a message to a channel a user cannot see

I am having issues sending a message to a log channel if the user who initiates a slash command is not able to see that channel
No description
3 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Marcus
MarcusOP9mo ago
// display embed
const embed = new EmbedBuilder()
.setTitle("Promotion")
.setDescription(`${username} promoted from ${prev_rank} to ${rank} by ${promoter} (${promoterUnique})`)
.setColor(0x33cc33)
.setTimestamp()
.setFooter({text: "UU Rank Bot", iconURL: "https://cdn.discordapp.com/attachments/1213574659111657613/1213574740875153408/overwatch.png?"})

interaction.reply({embeds: [embed]});
// var channel = interaction.guild.channels.cache.get('1213626882189430895');

try{
const channel = await client.channels.fetch(promotionLogs);
await channel.send({ embeds: [embed] });
console.log(`CHANNEL: ${channel}`);
}catch (error) {
console.error("Error sending message: ", error);
};
// display embed
const embed = new EmbedBuilder()
.setTitle("Promotion")
.setDescription(`${username} promoted from ${prev_rank} to ${rank} by ${promoter} (${promoterUnique})`)
.setColor(0x33cc33)
.setTimestamp()
.setFooter({text: "UU Rank Bot", iconURL: "https://cdn.discordapp.com/attachments/1213574659111657613/1213574740875153408/overwatch.png?"})

interaction.reply({embeds: [embed]});
// var channel = interaction.guild.channels.cache.get('1213626882189430895');

try{
const channel = await client.channels.fetch(promotionLogs);
await channel.send({ embeds: [embed] });
console.log(`CHANNEL: ${channel}`);
}catch (error) {
console.error("Error sending message: ", error);
};
Want results from more Discord servers?
Add your server