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

172
Views
Trying to scan the insides of an embed description

Im trying to scan the inside of an embed description "embed reader" and i keep getting this error and cant fix it. It worked on discord.js V12 but i switched to v13 so i can add it to my other bot.

const { Client, Intents} = require('discord.js');
const Discord = require('discord.js');

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
let prefix = ";";
let badwords = ["IP Logger", "grabify", "dlscord.com"]; 
client.on('ready', () => {
    console.log('Ready!');
});

client.on("message", async message => {
    const detectedEmbed = new Discord.MessageEmbed()
    .setColor('#0099ff')
    .setTitle('Detected')
    .setURL('https://discord.js.org/%27')
    .setAuthor("apphx the ass grabber")
    .setDescription('IP Logger Detected')
    .setThumbnail('https://kinsta.com/wp-content/uploads/2017/09/external-ip-address-1-1024x512.png%27')

    var content = message.content;
    var stringToCheck = content.replace(/\s+/g, '').toLowerCase();
    if(message.content.toLowerCase().includes( badwords))
    message.channel.send(detectedEmbed);
else {
    for (var i = 0; i < badwords.length; i++) {
        if (message.embeds[i].title.includes(badwords) && message.embeds[i].title.includes(badwords[i])){
            message.delete();
            message.channel.send(detectedEmbed)
            break
            }
        }
    }
})


client.login(verysecrettoken');

Error: https://pastebin.com/tPsUdCjB

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Shouldn't it be:

for (var i = 0; i < message.embeds.length; i++) {

There is nothing stopping i exceeding the number of embeds in the message and so when it does, message.embeds[i] doesn't exist.

It looks like you meant to iterate over the badwords array for each embed in the message.

    for (var i = 0; i < message.embeds.length; i++) {
      for (var j = 0; j < badwords.length; j++) {
        if (message.embeds[i].title.includes(badwords[j])){
            message.delete();
            message.channel.send(detectedEmbed)
            break
            }
        }
    }

Also, in v13 you probable have to have:

message.channel.send({ embeds: [detectedEmbed] })
about 4 years ago · Juan Pablo Isaza 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!