How to make discord send random images?

Hello! How do you make your discord bot say random images when someone has said a command like: [p]image or something? I want to make my bot send an image to the channel like a meme when someone says t!image (t! Is my prefix)

Hi @khaii-msp,

My own discord bot does something like this! You can add the Giphy API Support to your bot to get gifs for free! Would you like to know more?

Okay sure! It sounds interesting aha

Hey @khaii-msp,
Seems like you will like this!
First you need a SDK key to use, you can get it here"

then do npm install giphy-js-sdk-core (

Then in your code add this:

const GphApiClient = require(“giphy-js-sdk-core”);
const giphy = GphApiClient(process.env.GIPHYTOKEN);

Replace process.env.GIPHYTOKEN with your sdk key

And now create a command for this and put in this:

 giph .search("gifs", { q: args })

.then(response => {
var totalResponse =;
var responseIndex = Math.floor(Math.random() * 10 + 1) % totalResponse;
var responseFinal =[responseIndex];
${} Heres Your Gif! :slight_smile:,
files: [responseFinal.images.fixed_height.url]

replace args in"gifs", { q: args }) with what text you want to lookup


A warning when using the Giphy JS SDK Core package: use the latest version, which is v1.0.6. The Add Package button in the package.json will prompt you to update to v2.0.6 which is deprecated.

1 Like

Hello, for the sdk key will you need to upgrade the api key to get it? I’m not very experienced sorry :joy:

Can you explain in more detail? Not sure what im getting

Nevermind, I figured it out. Giphy wasn’t working for me.

bro can u explain ho to do it? or any video