Can someone help me with this?

I Always get this error and all of my repls close could someone please help me ?

const existing = channel.messages.cache.get(;

messages is only available on text-based channels. Use channel.isTextBased() to check if a channel is text-based.


can i give you the code and u check it please ? i really need help cause whenever i do all my bots go offline :frowning:

1 Like

Here is the code source

Hey, check out this stackoverflow post:
node.js - Cache message discord.js - Stack Overflow

I think it may have something to do with not loading anything so discord.js doesn’t have anything to cache.

could you check my code and tell me what’s wrong with it please ? cause 'm really lost :frowning:

not sure what you mean by check your code what are your thoughts on what the error is? What specific help do you need?

I cannot help you make your entire project

it’s not an entire project sir , it’s a simple code with welcome message on my channel that’s what it require and sometimes it works fine and sometimes i got the error on the pictures up : here is my code link * : here

okay well it doesn’t even seem like you tried looking at my suggestion

so try my suggestion first

I did Look

Did you try adding

client.on('ready', async () => {
  await client.guilds.fetch('guild-id-here');
  await guild.channels.cache.get('channel-id-here');
  await channel.messages.fetch('message-id-here');

Don’t forget to replace guild-id-here with the guild you are trying to load etc.

I did and i got this error

I don’t understand why sometimes it works perfectly and then all my repls got the same error …

oops my bad

client.on('ready', async () => {
  const guild = await client.guilds.fetch('guild-id-here');
  const channel = await guild.channels.cache.get('channel-id-here');
  const message = await channel.messages.fetch('message-id-here');
1 Like

I think it worked fine at the moment ur a life savor thank you so much but if i ihave any update i’ll notice you

1 Like

i still got the same error :frowning:

hmm maybe you should put this inside guildMemberAdd like

  await client.guilds.fetch(;

// ...
// const channel = member.guild.channels.cache. ...

also I noticed in your intents that you don’t have GUILDS and GUILD_MEMBERS so try those as well


i’m really lost like this ?

client.on('guildMemberAdd', member => {
  // ... add that code
// await client.guilds.fetch(;

// ...
1 Like