#Error when sending message
39 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
The id is invalid
It isn't though?
Not necessarily
Is the client logged in and do you have Guilds intent
Well GUILDS as this is v13
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_BANS,
Intents.FLAGS.GUILD_INTEGRATIONS,
Intents.FLAGS.GUILD_WEBHOOKS,
Intents.FLAGS.GUILD_INVITES,
Intents.FLAGS.GUILD_VOICE_STATES,
Intents.FLAGS.GUILD_PRESENCES,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_MESSAGE_TYPING,
Intents.FLAGS.DIRECT_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGE_REACTIONS,
Intents.FLAGS.DIRECT_MESSAGE_TYPING,
],
}); //Create client
These are my intents
Is the client logged in
client.login(token);
Check client.isReady()
And log what it says
And show us
client.once("ready", () => {
const channel = client.channels.cache.get('906674895239405678');
channel.send('content');
this?
if the code is running inside your ready event then yes, the id is likely incorrect
but it cant be?
uh yes it can
Well it can be if your ready event is emitting
If you really wanna check
const channel = await client.channels.fetch(<id>)
And see if it throws an error
DiscordAPIError: Missing Access
Then your bot doesn’t have access to that channel
It has administrator perms?
Idk does it?
Are you sure?
Yep
Well it doesn’t lol
Just checked, defo the right ID
Then you either don’t have the correct permissions or the id is still wrong
It don’t think it is, but i’ll search around for a solution