when checking for the number of characters in the argument, I ran into a problem that the bot sends
when checking for the number of characters in the argument, I ran into a problem that the bot sends the error "not such a number of characters in the argument" anyway, even if everything is correct
const { ApplicationCommandOptionType, EmbedBuilder } = require('discord.js');
module.exports = {
name: "test",
usage: "/test",
options: [
{
name: 'option',
description: '43-symbol',
type: ApplicationCommandOptionType.String,
required: true
}
],
category: "test",
description: "test",
ownerOnly: false,
run: async (client, interaction, args) => {
await interaction.deferReply({ephemeral: true});
if(!interaction.options.getString("option").lenght !== 43) {
interaction.editReply({
content: `not 43`
})
} else {
const embed = new EmbedBuilder()
.setThumbnail(client.user.displayAvatarURL())
.addFields([
{name: `yay`, value: `${interaction.options.getString("option")}`}
])
.setColor('#FF8747')
.setFooter({
text: `test`,
iconURL: `${client.user.displayAvatarURL()}`
});
return interaction.reply({
embeds: [embed],
ephemeral: true
});
}
}
}const { ApplicationCommandOptionType, EmbedBuilder } = require('discord.js');
module.exports = {
name: "test",
usage: "/test",
options: [
{
name: 'option',
description: '43-symbol',
type: ApplicationCommandOptionType.String,
required: true
}
],
category: "test",
description: "test",
ownerOnly: false,
run: async (client, interaction, args) => {
await interaction.deferReply({ephemeral: true});
if(!interaction.options.getString("option").lenght !== 43) {
interaction.editReply({
content: `not 43`
})
} else {
const embed = new EmbedBuilder()
.setThumbnail(client.user.displayAvatarURL())
.addFields([
{name: `yay`, value: `${interaction.options.getString("option")}`}
])
.setColor('#FF8747')
.setFooter({
text: `test`,
iconURL: `${client.user.displayAvatarURL()}`
});
return interaction.reply({
embeds: [embed],
ephemeral: true
});
}
}
}