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

129
Views
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 answers
Answer question

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 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!