Patrick_Bateman
Patrick_Bateman
DIAdiscord.js - Imagine an app
Created by Patrick_Bateman on 11/5/2024 in #djs-questions
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')
9 replies