#Slash Command (Command Options) String Error

5 messages · Page 1 of 1 (latest)

digital fog
#

Here is the file causing an issue

const { EmbedBuilder, SlashCommandBuilder, PermissionsBitField } = require('discord.js');
module.exports = {
    data: new SlashCommandBuilder()
    .setName('database')
    .setDescription('Access to the PA Admins database.')
    .addStringOption(option1 => option1.setName('Users').setDescription('bots|members'))
    .addStringOption(option2 => option2.setName('Roles').setDescription('staff|member'))
    .addStringOption(option3 => option3.setName('Applications').setDescription('role-giving|non-role-giving')),
    async execute(interaction){
        const roleDBEmbed = new EmbedBuilder()
        .setColor('#ce3636')
        .setTitle('❌ | You must be a Staff Member to access the database.')
        const passRole = interaction.guild.roles.cache.get('ID')
        if (!interaction.member.roles.cache.has(passRole)) {
            return interaction.reply({ embeds: [roleDBEmbed], ephemeral:true })
        }
        const users = interaction.options.getString('Users');
        const roles = interaction.options.getString('Roles');
        const applications = interaction.options.getString('Application');
    }

}
#

Here is the error message

D:\PA_Admin Backup\node_modules\@sapphire\shapeshift\dist\index.js:76
    throw this.error;
    ^

ExpectedConstraintError: Invalid string format
    at Object.run (D:\PA_Admin Backup\node_modules\@sapphire\shapeshift\dist\index.js:1564:64)
    at D:\PA_Admin Backup\node_modules\@sapphire\shapeshift\dist\index.js:142:66
    at Array.reduce (<anonymous>)
    at StringValidator.parse (D:\PA_Admin Backup\node_modules\@sapphire\shapeshift\dist\index.js:142:29)
    at validateName (D:\PA_Admin Backup\node_modules\@discordjs\builders\dist\index.js:782:17)
    at MixedClass.setName (D:\PA_Admin Backup\node_modules\@discordjs\builders\dist\index.js:856:5)
    at D:\PA_Admin Backup\Slash Commands\database.js:6:41
    at MixedClass._sharedAddOptionMethod (D:\PA_Admin Backup\node_modules\@discordjs\builders\dist\index.js:1256:50)  
    at MixedClass.addStringOption (D:\PA_Admin Backup\node_modules\@discordjs\builders\dist\index.js:1245:17)
    at Object.<anonymous> (D:\PA_Admin Backup\Slash Commands\database.js:6:6) {
  constraint: 's.string.regex',
  given: 'Users',
  expected: 'expected /^[\\p{Ll}\\p{Lm}\\p{Lo}\\p{N}\\p{sc=Devanagari}\\p{sc=Thai}_-]+$/u.test(expected) to be true'  
}
gentle canopy
#

names have to be lowercased

digital fog
#

🤦‍♂️

#

oops