When an embed
has a footer
or not, it sends a message to console, but the second if (!embed[i] || !embed[i].footer || embed[i].footer.text === null)
does not work, but if I go down to if (embed[i] && embed[i].footer && embed[i].footer.text !== null)
and I go up if (!embed[i] || !embed[i].footer || embed[i].footer.text === null)
, now if (embed[i] && embed[i].footer && embed[i].footer.text !== null)
does not respond, the second if
doesn't never work
const { Client, Intents } = require("discord.js-selfbot");
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
],
});
let token = "";
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on("message", (message) => {
if (message.embeds.length >= 0) {
// Check if the Message has embed or not
let embed = message.embeds;
for (let i = 0; i < embed.length; i++) {
if (embed[i] && embed[i].footer && embed[i].footer.text !== null)
return;
// check each embed if it has footer or not
{
console.log("no have footer");
}
if (!embed[i] || !embed[i].footer || embed[i].footer.text === null)
return;
// check each embed if it has footer or not
{
console.log("have footer");
}
}
}
});
client.login(token);
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment