M
M
MoneySMile2022-04-18 20:09:31
Node.js
MoneySMile, 2022-04-18 20:09:31

Why doesn't the bot send a message to Discord.js?

The bot gives an error when sending a message. What could be wrong?

the code
module.exports.properities = {
    name:["123"]
}
module.exports.run = async (bot,message,member,args) => {
    const asd = bot.channels.cache.get('678246128806002700')
    asd.send(`1`)
}

mistake

C:\Users\Александр\Documents\GitHub\-1iqminebot\commands\123.js:9
asd.send(`1`)
^

TypeError: Cannot read properties of undefined (reading 'send')
at Object.module.exports.run (C:\Users\Александр\Documents\GitHub\-1iqminebot\commands\123.js:9:9)
at Client. (C:\Users\Александр\Documents\GitHub\-1iqminebot\index.js:21:17)
at Client.emit (node:events:390:28)
at MessageCreateAction.handle (C:\Users\Александр\Documents\GitHub\-1iqminebot\node_modules\discord.js\src\client\actions\MessageCreate.js:34:18)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Александр\Documents\GitHub\-1iqminebot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\Александр\Documents\GitHub\-1iqminebot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketShard.onPacket (C:\Users\Александр\Documents\GitHub\-1iqminebot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\Александр\Documents\GitHub\-1iqminebot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\Александр\Documents\GitHub\-1iqminebot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:390:28)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eshran, 2022-04-24
@eshran

module.exports.properities = {
    name: ["123"]
}
module.exports.run = async (bot,message,member,args) => {
    const asd = message.guild.channels.cache.get('678246128806002700')
    asd.send(`1`)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question