I am using Discord.js v14.8 and it was written in typescript i have package:
"dependencies": {
"@discordjs/rest": "^1.1.0",
"@supabase/supabase-js": "^2.25.0",
"@types/node": "^18.7.14",
"discord.js": "14.8.0",
"dotenv": "^16.0.2",
"express": "^4.18.2",
"fs": "^0.0.1-security",
},
"devDependencies": {
"@types/express": "^4.17.17",
"typescript": "^4.9.5"
},
"overrides": {
"discord-api-types": "0.37.20"
}
I am having issues with my /help
or even at normal command !help
, i will show you the /help
command code:
import { SlashCommandBuilder, ChannelType, TextChannel, EmbedBuilder } from "discord.js"
import { getThemeColor } from "../functions";
import { SlashCommand } from "../types";
const command : SlashCommand = {
command: new SlashCommandBuilder()
.setName("help")
.setDescription("Shows the information about the bot")
,
execute: interaction => {
interaction.reply({
embeds: [
new EmbedBuilder()
.setAuthor({name: "XXX.XX", iconURL: "https://i.imgur.com/XXXX.png"})
.setTitle("XXXX")
.setThumbnail("https://i.imgur.com/XXX.png")
.setColor(getThemeColor("text"))
.setDescription(
"discord bot developed by <@XXXXXXXXX>."
)
.addFields(
{ name: 'Application Commands', value: '`/help`, `/XXX`, `/xxx`, `/xx`, `/xx`' },
)
.setTimestamp()
.setImage("https://i.imgur.com/XXXXX.png")
.setFooter({ text: "Powered by XXXX", iconURL: interaction.client.user?.avatarURL() || undefined })
]
})
},
cooldown: 30
}
export default command
and this is the output error:
this is the error:
/home/container/node_modules/discord.js/src/structures/MessagePayload.js:200
isJSONEncodable(embed) ? embed.toJSON() : this.target.client.options.jsonTransformer(embed),
^
TypeError: isJSONEncodable is not a function
at /home/container/node_modules/discord.js/src/structures/MessagePayload.js:200:9
at Array.map (<anonymous>)
at MessagePayload.resolveBody (/home/container/node_modules/discord.js/src/structures/MessagePayload.js:199:36)
at TextChannel.send (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:169:32)
at Message.reply (/home/container/node_modules/discord.js/src/structures/Message.js:803:25)
at /home/container/build/commands/help
.js:17:17
at Generator.next (<anonymous>)
at /home/container/build/commands/help.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/container/build/commands/help.js:4:12)
but this one works fine which is the /ping
command:
import { SlashCommandBuilder, ChannelType, TextChannel, EmbedBuilder } from "discord.js"
import { getThemeColor } from "../functions";
import { SlashCommand } from "../types";
const command : SlashCommand = {
command: new SlashCommandBuilder()
.setName("ping")
.setDescription("Shows the bot ping/latency.")
,
execute: interaction => {
interaction.reply({
embeds: [
new EmbedBuilder()
.setAuthor({name: "Test"})
.setDescription(`📡 Ping: ${interaction.client.ws.ping}ms`)
.setColor(getThemeColor("text"))
]
})
},
cooldown: 30
}
export default command
This issue was fixed on Discord.js 14.10.2