Im using discord V13 and im getting this error. (If you prefer you can look at the code in this link: https://sourceb.in/8w8wKS1Wmy)
Main file:
// main.js
const Discord = require('discord.js');
The command file:
// command
const {
MessageActionRow,
MessageButton
} = require('discord.js');
module.exports = {
name: 'commands',
permissions: [],
description: "this sends help!",
aliases: ['cmd', 'cmdinfo', 'commandsinfo'],
execute(client, message, cmd, args, Discord) {
const utilbtn = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('primary')
.setLabel('Primary')
.setStyle('PRIMAMRY'),
);
const newEmbed = new Discord.MessageEmbed()
.setTitle('**Commands**')
message.channel.send({
embed: [newEmbed],
component: [utilbtn]
});
}
}
}
The error message:
// the error
const utilbtn = new MessageActionRow()
^
TypeError: MessageActionRow is not a constructor
I cannot imagine how this is not working, unless if you are using the wrong version, consider running:
npm i discord.js@13.1.0
I've tried running both:
const { MessageActionRow } = require('discord.js');
// undefined
new MessageActionRow()
// MessageActionRow { type: 'ACTION_ROW', components: [] }
The commented lines are the response when running node in console. Maybe try checking package.json, should have a line like the following:
"discord.js": "^13.1.0"