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

238
Views
¿Cómo puedo hacer que Discord.js Image scraper envíe una nueva imagen cada vez?

He estado jugando con el raspador de imágenes (discord.js v13). Me encantaría hacerlo así cada vez que hago, por ejemplo ?image car , envía una imagen diferente del auto.

Este es mi código rn, es simplemente raspador simple básico

 const google = new Scraper({ puppeteer: { headless: true, }, }); module.exports = { name: 'image', description: 'Send picture (possibly automatically maybe)', async execute( kaoru, message, args, Discord){ const image_query = args.join(' '); if(!image_query) return message.channel.send('> **Please enter name of the image!**'); const image_results = await google.scrape(image_query, 50); message.channel.send(image_results[0].url) } }``` Any ideas? I tried to google help, but didnt find anything. Also i think it has something to do with this part: ```message.channel.send(image_results[0].url)``` Because if i change [0] to [2] for example, it changes that pic. But it would be cool if it would send pics between 0-100
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar un aleatorizador para establecer el valor en image_results. Como esto:

 image_results[Math.floor(Math.random() * 50)].url

Eso debería darte un número entero aleatorio entre 0 y 49 (el índice js comienza en 0).

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!