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

241
Visualizações
I get this error: Cannot read properties of undefined (reading 'send') when I run the command I made, What do I do?

So I am trying to make an embed rules message for my server and I get an error saying "Cannot read properties of undefined (reading 'send')".

The code:

const message = require("../events/guild/message")
const { MessageEmbed } = require('discord.js')

module.exports = {
    name: 'spawnrules',
    description: "Spawn the server rules",
    execute(message, args, Discord, client) {
        const rules = new MessageEmbed()
        .setColor('LIME')
        .setTitle('Rules')
        .setDescription('These are the server rules, Make sure to follow them to avoid being punished.')
        .addFields(
            {name: '1'},
            {name: 'Do not be racist', value: '2'},
            {name: '2'},
            {name: '3'},
            {name: 'No NSFW', value: 'NSFW is forbidden in our server. NSFW will result in a discord report and a permanent ban.'},
        )
        .setFooter('32')
        message.channel.send(rules)
    }
}

Error:

        message.channel.send(rules)
                        ^

TypeError: Cannot read properties of undefined (reading 'send')
    at Object.execute (C:\Teams\Team Lapis\Lapis Bot\commands\spawnrules.js:20:25)
    at module.exports (C:\Teams\Team Lapis\Lapis Bot\events\guild\message.js:9:25)
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Teams\Team Lapis\Lapis Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Teams\Team Lapis\Lapis Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Teams\Team Lapis\Lapis Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Teams\Team Lapis\Lapis Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Teams\Team Lapis\Lapis Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Teams\Team Lapis\Lapis Bot\node_modules\ws\lib\event-target.js:132:16)
    at WebSocket.emit (node:events:520:28)

I'd appreciate it if someone will help :)

about 4 years ago · Juan Pablo Isaza
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