Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.2K
Views
Discord.JS Slash Command Error: "ExpectedConstraintError: formato de cadena no válido"

Aquí está mi código

 const { SlashCommandBuilder } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('Ping') .setDescription('Return my ping'), async execute(interaction, client) { const message = await interaction.deferReply({ fetchReply : true }); const newMessage = `API Latency: ${client.ws.ping}\nClient Ping: ${message.createdTimestamp - interaction.createdTimestamp}` await interaction.editReply({ content: newMessage }); } }

Y aquí está el error de la consola.

 C:\Users\The Friesen Boy's\Desktop\georgebot\node_modules\@sapphire\shapeshift\dist\index.js:1564 return regex.test(input) ? Result.ok(input) : Result.err(new ExpectedConstraintError(type, "Invalid string format", input, expected)); ^ ExpectedConstraintError: Invalid string format at Object.run (C:\Users\The Friesen Boy's\Desktop\georgebot\node_modules\@sapphire\shapeshift\dist\index.js:1564:64) at C:\Users\The Friesen Boy's\Desktop\georgebot\node_modules\@sapphire\shapeshift\dist\index.js:142:66 at Array.reduce (<anonymous>) at StringValidator.parse (C:\Users\The Friesen Boy's\Desktop\georgebot\node_modules\@sapphire\shapeshift\dist\index.js:142:29) at validateName (C:\Users\The Friesen Boy's\Desktop\georgebot\node_modules\@discordjs\builders\dist\index.js:782:17) at MixedClass.setName (C:\Users\The Friesen Boy's\Desktop\georgebot\node_modules\@discordjs\builders\dist\index.js:856:5) at Object.<anonymous> (C:\Users\The Friesen Boy's\Desktop\georgebot\src\commands\tools\ping.js:5:10) at Module._compile (node:internal/modules/cjs/loader:1120:14) at Module._extensions..js (node:internal/modules/cjs/loader:1174:10) at Module.load (node:internal/modules/cjs/loader:998:32) { constraint: 's.string.regex', given: 'Ping', expected: 'expected /^[\\p{Ll}\\p{Lm}\\p{Lo}\\p{N}\\p{sc=Devanagari}\\p{sc=Thai}_-]+$/u.test(expected) to be true' } Node.js v18.6.0

¿Alguien sabe una solución a esto? No pude encontrar una respuesta. Hay otro hilo sobre este tema y no solucionó mi problema.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Según el seguimiento de la pila, 'Ping' parece ser un nombre de comando no válido. ¿Ha intentado usar 'ping' (minúsculas) como se indica en los documentos ?

 new SlashCommandBuilder().setName('ping')
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!