Please Help Me For My Bot

My Discord bot suddenly shut down today, I updated everything and the bot was opened, but when using commands it gets an error, and new Discord.Richembed () also gives an error whenever I use commands. please help me :((

Please elaborate :slight_smile: Can you send the error printed in the console.

1 Like

discord.js v11 is now broken and unmaintained and discord.js v12 is NOT compatible with existing code.

If you’re using v12, then it’s MessageEmbed instead of RichEmbed.

var embed = new Discord.MessageEmbed

(node:5175) UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor

1:17 PM

Jump Toat Client.client.on (/app/bot.js:90:9)

1:17 PM

at Client.emit (events.js:198:15)

1:17 PM

at MessageCreateAction.handle (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)

1:17 PM

at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)

1:17 PM

at WebSocketManager.handlePacket (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)

1:17 PM

at WebSocketShard.onPacket (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)

1:17 PM

at WebSocketShard.onMessage (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)

1:17 PM

at WebSocket.onMessage (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/event-target.js:125:16)

1:17 PM

at WebSocket.emit (events.js:193:13)

1:17 PM

at Receiver.receiverOnMessage (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/ws/7.3.1/node_modules/ws/lib/websocket.js:797:20)

1:17 PM

(node:5175) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

1:17 PM

(node:5175) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

i tried version 11 to 12 but error again

I try all versions

error is this
on log
this error comes up every time I use a command

Send the code for the command that throws the error of MessageEmbed doesn’t work. I need more context.

if (command === “çal” || command === “p” || command === “play”) {
const voiceChannel = msg.member.voiceChannel;
if (!voiceChannel)
return msg.channel.send(
new Discord.RichEmbed()
.setColor("#000000")
.setDescription(“:loud_sound: Bir sesli kanalda olman lazım.”)

i tried this command and error :frowning:

i try jump to error and glitch is give this commadn: new Discord.RichEmbed()

if (command === “çal” || command === “p” || command === “play”) {
const voiceChannel = msg.member.voiceChannel;
if (!voiceChannel)
return msg.channel.send(
new Discord.RichMessageEmbed()
.setColor("#000000")
.setDescription(“:loud_sound: Bir sesli kanalda olman lazım. ”)

Have you tried this yet? (Replace Rich with Message)

at Client.client.on (/app/bot.js:90:9)

1:29 PM

at Client.emit (events.js:198:15)

1:29 PM

at MessageCreateAction.handle (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)

1:29 PM

at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)

1:29 PM

at WebSocketManager.handlePacket (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)

1:29 PM

at Immediate.client.setImmediate (/rbd/pnpm-volume/bffc0b5d-1de3-4e12-8723-38b60a0476bb/node_modules/.registry.npmjs.org/discord.js/12.3.1/node_modules/discord.js/src/client/websocket/WebSocketManager.js:379:14)

1:29 PM

at processImmediate (internal/timers.js:443:21)

1:29 PM

(node:7388) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

error again :frowning:

not working

yep. im not sure it might be something to do with the message variable. tbh I need another (more experienced) opinion.

what you need ?

if (command === “çal” || command === “p” || command === “play”) {
const voiceChannel = msg.member.voiceChannel;
if (!voiceChannel) {
const embed = new Discord.MessageEmbed()
.setColor("#000000")
.setDescription(“":loud_sound:  **Bir sesli kanalda olman lazım.** ")
return msg.channel.send(embed)
}
1 Like

Try that

1 Like

image

i cant text my discord is : ⨈ Torpak#0048

Not inside the message lol

1 Like

This should be the rough layout of ur if statement

if (command === “çal” || command === “p” || command === “play”) {
const voiceChannel = msg.member.voiceChannel;
if (!voiceChannel) {
const embed = new Discord.MessageEmbed()
.setColor("#000000")
.setDescription(“":loud_sound:  **Bir sesli kanalda olman lazım.** ")
return msg.channel.send(embed)
}
// other music code
}
1 Like

I see… That’s MusicBot command… Try this one:

if (command === “çal” || command === “p” || command === “play”) {
const voiceChannel = msg.member.voice.channel;
//Now, discord.js v12 using message.member.voice.channel 
if (!voiceChannel) {
const embed = new Discord.MessageEmbed()
.setColor("#000000")
.setDescription(“":loud_sound:  **Bir sesli kanalda olman lazım.** ")
return msg.channel.send(embed)
}

Where you put

const embed = new Discord.MessageEmbed()

replace it with

new Discord.MessageEmbed()

Or define the MessageEmbed before the send function.

It looks like you’re new of coding.

I suggest you to learn JavaScript first, Then continue to NodeJS.

1 Like

Yeah, you’re very new to the NodeJS language. Please begin with JS first and then move on to NodeJS.

Also, for the sake of helping you through, please, at the top, put this string.
const { MessageEmbed } = require(‘discord.js’)

Wherever you want an embed, please put this string:

const = new MessageEmbed():
And then just .setTitle your new message(MAKE SURE YOU INDENT)
and then .setDescription whatever.

Best wishes,
Codex10

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.