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

138
Visualizações
Is it possible to delete the embed if it has a certain word after its edited

in this form if possible

client.on('messageUpdate', (oldMessage, newMessage) => {
  const words = ['word1', 'word2']

  });

Tried using embed.title.includes('word') but did not work

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If there is an embed in a message, you can get the embeds' data through message.embeds. This return an array of MessageEmbed in the message if exist or null if there is no embed. Now you just check each the embed, parse it to JSON and get its properties(embed.title, embed.description, etc...).
Here is an example of getting embeds' data:

const embeds = message.embeds?.map(embed => embed?.toJSON()); // Get array of message embeds parsed to JSON
if (!embeds) return; // Return if no embed in the message
let include = false; // Define the variable to check in each embed
for(let i = 0; i < embeds.length; i++) { // Loop through the embeds gotten from message
    const embed = embeds[i];
    // The variables below are the embed's part which can contain string
    const title = embed.title;
    const description = embed.description;
    const footer = embed.footer?.text; // footer maybe null, put ? after footer won't throw error "Can not read property of null (reading 'text')"
    if (title?.includes('word') || description?.includes('word') || footer?.includes('word')) { // Check if the embed contains 'word' or not
        include = true; // The embed contains the word, so set `include` to true
        break; // We now have what we need, destroy the loop
    }
}
if (include) console.log('The message embeds contain the `word` word!');
else { console.log('The message embeds don\'t contain the `word` word.'); }
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