Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

297
Visualizações
Error below TypeError: Cannot read properties of undefined (reading 'channels')

I have this small problem where I get the Cannot read properties of undefined error, but I don't know where the issue is. Can someone help me with this one?

const Discord = require('discord.js');
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] }, { partials: ["MESSAGE", "CHANNEL", "REACTION" ]})
const { prefix, token } = require ('./config.json');
const fs = require('fs');


client.commands = new Discord.Collection();
 
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}

var serverID  = '832712939457871882';
var channelID = '832712940562022480';
var messageID = '833299637996748800';
var categoryID= '833295884992643102';

client.on('ready', () => {
    console.log("[+] bot is up!")

    //Ticket module
    client.guilds.cache.get(serverID) //serverID
    .channels.cache.get(channelID) //channelID
    .messages.fetch(messageID).then(msg => msg.react('🎟️')) //messageID
});

ERROR

C:\Users\MIG TECNICA\Desktop\dbotrp\index.js:35
    .channels.cache.get(channelID) //channelID
    ^

TypeError: Cannot read properties of undefined (reading 'channels')
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Use client.guilds.fetch(‘guild id here’).channels.cache.find(c => c.id === ‘channel id here’).messages.fetch(‘message id here’).then(msg => { msg.react(‘emoji here’); });

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda