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

130
Vistas
I want to make a Discord meme bot using JavaScript

I have recently made a Python Discord bot and I want to built the same with JavaScript. I am totally new in this language and I don't know how I will add the meme command in.

in the Python version, I used a website heroukuapp to get memes from subreddit.

Here's how I made it in Python-

if message.content == 'Show me some memes':
            content = get("https://meme-api.herokuapp.com/gimme").text
            data = json.loads(content,)
            meme = discord.Embed(title=f"{data['title']}", Color = discord.Color.random()).set_image(url=f"{data['url']}")
            await message.channel.send("MEMEY.....MEMEY.....MEMEY......\n")
            await message.channel.send(embed=meme)

I want to use the same website for displaying memes in the JS bot (in embeds form). I have tried many APIs and seen many videos, but still I ccouldnt use them.

Till now, this is what I have done in JavaScript-

case "Show me some memes":
        message.channel.send("MEMEY.....MEMEY.....MEMEY......\n")
        
break;

Can anyone solve my query?

Thanks for viewing my post.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You may use got an Node.js based HTTPS request library to request the API and further parse the response and use the things you need from the body ( alternatives - node-fetch ( previously snekfetch - ESM module ))

Here's an example:

const got = require("got");
const { MessageEmbed } = require("discord.js");
got("https://meme-api.herokuapp.com/gimme").then( (response) => {
const data = JSON.parse(response.body);
let meme = new MessageEmbed
.setTitle(`${data['title']}`);
.setColor("RANDOM");
.setImage(`${data['url']}`)
message.channel.send({ content: "MEMEY..MEMEY...MEMEY...", embeds: [meme]});
});

This is specifically for discord.js v13 if you're on any version that's below 13 you may directly pass the embed object like so:

message.channel.send(meme);
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