Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!