Estoy tratando de hacer un comando en discord.js .
Quiero hacerlo donde ?party (link or something here) requirements: be cool se escribe y luego diría
@user ha hecho ping para la fiesta Enlace: (enlace que se publicó) requisitos: sé genial
Soy nuevo en discord.js , así que estoy tratando de aprender. ¡Gracias!
Bueno, probablemente cambie su comando para que sea algo como:
?party (link) (be cool) . Mantén las cosas simples :)
Luego, podría analizar el contenido del comando y separar el enlace de los requisitos, así:
text = message.content; // check if the text is a command for your bot if (text.startsWith("?party")) { // convert the contents of the command to an array, by splitting the text at spaces // Also get the rid of the command itself (?party) commandContents = text.split(" ").slice(1); link = commandContents[0]; requirements = commandContents.slice(1).join(" "); // join the requirements back by spaces. if (!link) { message.channel.send(" no link"); } else if (!requirements) { message.channel.send(" no requirements"); } else { message.channel.send( `<@${message.author.id}> has pinged for party\n \n Link: ${link}]\n\nRequirements:${requirements}\n\n@everyone` ); } }