Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
Image Scraper pushing all attachments from single message to array

I've been using this script here https://github.com/17teen/Discord-Image-Scraper but stumbled on an issue where it scrapes from a single message that contains say 5 attachments and pulls them to the JSON array as a whole instead of separating them into individual links as if it was an image per message.

I've tried using .replace(',','') and .join(',') in both post.js and the scraper.js and still face this issue.

[
"https://media.discordapp.net/attachments/831804312538841088/893067795154231337/IMG_20210930_113200.jpg,https://media.discordapp.net/attachments/831804312538841088/893067795322011668/IMG_20210930_113039.jpg,https://media.discordapp.net/attachments/831804312538841088/893067795535900702/IMG_20210930_112940.jpg,https://media.discordapp.net/attachments/831804312538841088/893067795741437952/IMG_20210930_113006.jpg","EXTRA","EXTRA"
]
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Thanks to @MrMythical for the fix solution to the problem.

For anyone using this code, the fix is below:

The original code was

webhookCli.send(link.split(",")).then((msg) => { 
     spinner.succeed(greenBright(`[${index}] Link Posted: ${yellowBright(msg.content)}`))
}).catch((err) => { 
   spinner.fail(red(`[${index}] Link failed to post | ${err}`)) 
})

IMPROVED CODE Added solution to link

// Settings
const { webHook_id, webHook_token } = require("./settings.json");
const { greenBright, red, grey, yellowBright } = require("chalk");
const ora = require("ora");
const readline = require("readline").createInterface({ input: process.stdin, output: process.stdout });

// Modules
const { WebhookClient } = require("discord.js");

// Webhook
const webhookCli = new WebhookClient(webHook_id, webHook_token);

readline.question(grey("[?] Do you wish to post these links? (Y/N) "), (answr) => {
    if (answr === "Y" || answr === "y" || answr === "Yes" || answr === "yes" || answr === "YES") return Post()
    if (answr === "N" || answr === "n" || answr === "No" || answr === "no" || answr === "NO") return process.exit(1);
});

/**
 * Posts links to a specifed channel
 */
function Post() {
    const spinner = ora("Preparing to post").start();
    const fetchLinks = require("./links.json")
    fetchLinks.forEach((link, index) => {
        webhookCli.send(link.split(",")).then((msg) => { spinner.succeed(greenBright(`[${index}] Link Posted: ${yellowBright(msg.content)}`)) }).catch((err) => { spinner.fail(red(`[${index}] Link failed to post | ${err}`)) })
    });
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda