Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda