Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
Is there a way to split up a message based off special characters?

I am currently trying to make a discord bot with a command title "reactionrole". In this command I would like to let the user create an embed using a single message. For example, (-reactionrole "title blah blah" / "description blah blah" / "role1" "role2" / "emoji1" "emoji2") would be sent as a Discord message. Here's what I've tried so far

name: 'reactionrole',
    description: "Sets up a reaction role message!",
    async execute(message:any, args:any, Discord:any, client:any) {
        const slicePoint = ('/');
        var segments = message.content.includes(slicePoint.length).split(slicePoint);
         var msg = message.content;
         var segments = msg.split('/');
         var firstRole = message.guild.roles.cache.find((role:any) => role.name === segments[2]);
         var firstEmoji = segments[3];
         var secondRole = message.guild.roles.cache.find((role:any) => role.name === segments[2]);
         var secondEmoji = segments[3];

let embed = new Discord.MessageEmbed()
         .setTitle(segments[0])
         .setDescription(segments[1])

and then there'd also be some reactions that would be added based off Segments 2 and 3 but I already know how to make that. If anyone could help that'd be amazing

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

So you mean like a separator?



const separated = message.content.slice(prefix.length).trim().split(" / ")
console.log(separated[1])
//This should serve what you're trying to achieve
// If I send a message like !separate hello :) / there, if u log them, you'd get 'hello :)' and 'there' separately
 

about 4 years ago · Juan Pablo Isaza Denunciar

0

I suspect the problem is the use of message as an identifier conflicting with the built-in Window.message event. Use another identifier.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda