this.options.components?.map is not a function
I've looked online but can't find an answer as most of the solutions are to update node.js of which I have the latest version
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, Component } = require('discord.js');
function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() *
charactersLength));
}
return result;
}
module.exports = {
data: new SlashCommandBuilder()
.setName('script')
.setDescription('รับสคริป'),
execute: async (interaction, con, log, client, config) => {
log(`[LOG Command] ${interaction.user.username}, use command getscript`, "green")
const user = interaction.options.getUser('user');
const menu = new ActionRowBuilder().addComponents(
new StringSelectMenuBuilder()
.setCustomId("SELRCTION")
.addOptions(
{ label: "BloxFruit", description: "script BloxFruit ", value: "BF", emoji: ""},
),
);
/*interaction.relpy({ content: "You Select ", ephemeral: true, components: {menu}});*/
await con.query(`SELECT userkey, discord_id,Blacklisted FROM bloxfruit Where discord_id = '${interaction.user.id}'`, async function(err, results, fields) {
if(!results[0]) {
await interaction.reply({
embeds: [
new EmbedBuilder()
.setColor("#FF0000")
.setTitle('**"WET HUB" | ᴡʜɪᴛᴇʟɪsᴛ ᴍᴀɴᴀɢᴇʀ**')
.setDescription("คุณไม่มีไวริสนะคะ กรุณาก่อนใช้ด้วยค่ะ")
.setTimestamp()
],
ephemeral: true
})
} else {
if(results[0].Blacklisted == "True") {
await interaction.reply({
embeds: [
new EmbedBuilder()
.setColor("#FF0000")
.setTitle('**WET HUB | ᴡʜɪᴛᴇʟɪsᴛ ᴍᴀɴᴀɢᴇʀ**')
.setDescription("คุณอยู่ในบัญชีดำนะคะ")
.setTimestamp()
],
ephemeral: true
})
} else {
let key = results[0].userkey
let discord_id = results[0].discord_id
await interaction.reply({ content: "You Select ", ephemeral: true, components: {menu}})
if (value == "BF") {
await interaction.reply({
embeds: [
new EmbedBuilder()
.setColor("00FF46")
.setTitle('**WET HUB | ᴡʜɪᴛᴇʟɪsᴛ ᴍᴀɴᴀɢᴇʀ**')
.setDescription('```lua\ngetgenv().Key = "'+ key + '"\ngetgenv().DiscordId = "'+ discord_id + '"\nloadstring(game:HttpGet("https://raw.githubusercontent.com/Galiverking/CheckPointWT/main/check-lua.lua"))()```')
.setTimestamp()
],
ephemeral: true
})
}
};
}
})
}
}
This is my code, but for some reason, it's returning a mapping error even though I'm not using the inbuilt function and is returning this error:
C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\discord.js\src\structures\MessagePayload.js:137
const components = this.options.components?.map(c => (isJSONEncodable(c) ? c : new ActionRowBuilder(c)).toJSON());
^
TypeError: this.options.components?.map is not a function
at MessagePayload.resolveBody (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\discord.js\src\structures\MessagePayload.js:137:49)
at ChatInputCommandInteraction.reply (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:109:56)
at Query.<anonymous> (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\commands\getscript.js:57:31)
at Query.<anonymous> (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\mysql\lib\Connection.js:526:10)
at Query._callback (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\mysql\lib\Connection.js:488:16)
at Sequence.end (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\mysql\lib\protocol\sequences\Sequence.js:83:24)
at Query._handleFinalResultPacket (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\mysql\lib\protocol\sequences\Query.js:149:8)
at Query.EofPacket (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\mysql\lib\protocol\sequences\Query.js:133:8)
at Protocol._parsePacket (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (C:\Users\user\Documents\BOT WHITELIST PACK\main\slash_BOT\node_modules\mysql\lib\protocol\Parser.js:433:10)
Node.js v19.6.1
components
should be an array, not an object. You'll need to update theinteraction.reply
like this: