Read and scrapy an embed

hi , i'm receving an embed from another bot to my discord channel ( my bot is already inside my channel with all permissions), i wanna read and scrape the link inside the embed and send it to my api project , i don't understand how i can do that . i built this code with the help of chat gbt but i haven't a response on my terminal beyond client.once('ready', () => { console.log(Bot connesso come ${client.user.tag}); }); import { Client, GatewayIntentBits } from 'discord.js'; const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent ] });

client.once('ready', () => { console.log(Bot connesso come ${client.user.tag}); });
client.on('messageCreate', (message) => { if (message.author.bot) return;
if (message.embeds.length > 0) { message.embeds.forEach(embed => { const title = embed.title 'Nessun titolo'; const description = embed.description 'Nessuna descrizione'; const fields = embed.fields || [];
console.log(Titolo: ${title}); console.log(Descrizione: ${description}); fields.forEach(field => { console.log(${field.name}: ${field.value}); });
}); } else { console.log("Il messaggio non contiene embed."); } }); client.login('token')
6 Replies
d.js toolkit
d.js toolkit3w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs3w ago
Codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!');
monbrey
monbrey3w ago
But the reason this doesn't work is because the first line in your messageCreate event is there to ignore messages from other bots. If you're going to use AI to generate your code please at least take the time to have it explain what the code does to you as well, to make sure it's actually what you're asking for
Patrick_Bateman
Patrick_BatemanOP3w ago
how can i fix it ? sorry but for mi it's the first time with discord js and i didnt find any videos or valid docu
monbrey
monbrey3w ago
We have an entire documentation site and guide https://discord.js.org https://discordjs.guide You can fix it by removing the line that I said does something you dont want it to do
Patrick_Bateman
Patrick_BatemanOP3w ago
thanks man , i'll try it
Want results from more Discord servers?
Add your server