memecub

How do I add reaction GIFs to a Discord bot?

To add reaction GIFs to a Discord bot, pick a GIF source (a local folder, a hosted URL, or a GIF API), then have the bot send the GIF as a file attachment or embed when a trigger fires. In discord.py you send it with channel.send(file=discord.File(...)) or an embed image URL; in discord.js you use channel.send({ files: [...] }) or an embed. Keep a small map of trigger words to GIFs so the bot does not post the same image every time.

How it works

A reaction GIF is just an image file with the .gif extension. Discord shows it inline when the bot uploads it as an attachment or puts its URL in an embed image field. Discord's own reaction emoji system only accepts emoji and custom emoji, not GIFs, so a GIF reaction is really a message the bot sends.

The flow is: listen for a message event, match a trigger (a word, a command, or a random chance), pick a GIF, then send it. Store GIFs as local files or URLs in a dictionary keyed by trigger so the code stays short.

discord.py example

Put your GIFs in a folder next to the bot file and map words to filenames:

REACTIONS = {"dog": "gifs/dog.gif", "lol": "gifs/lol.gif"}

@bot.event async def on_message(message): if message.author.bot: return for word, path in REACTIONS.items(): if word in message.content.lower(): await message.channel.send(file=discord.File(path)) break

For a URL instead of a file, use an embed: embed = discord.Embed(); embed.set_image(url=gif_url); await message.channel.send(embed=embed). Remember to enable the message content intent in the developer portal, or message.content will be empty.

discord.js example

The same idea in discord.js v14:

const reactions = { dog: "./gifs/dog.gif", lol: "./gifs/lol.gif" }; client.on("messageCreate", async (message) => { if (message.author.bot) return; for (const [word, file] of Object.entries(reactions)) { if (message.content.toLowerCase().includes(word)) { await message.channel.send({ files: [file] }); break; } } });

For a hosted GIF, send { embeds: [{ image: { url: gifUrl } }] } instead. Keep the files small and few; large GIFs upload slowly and hit message size limits.

Where to get GIFs and how to keep it polite

You can bundle your own GIFs, use a GIF API, or search a meme library. memecub has a REST API and a CLI (npx memecub) for searching reaction images, with a keyless trial of 20 searches a day; its AI meme maker can create a custom reaction when nothing fits. Most memecub images are collected from the web, so they are fine for personal chats but not for commercial use; the openly licensed filter is the safe choice for a public bot.

Rate-limit the bot: one GIF per message, a cooldown per channel, and skip bots and commands. Randomize among several GIFs per trigger so the reaction does not feel canned, and give users a way to turn it off.

Let your AI find the memes

REST API, remote MCP, CLI and a skill. Try 20 searches a day without a key.

More that fit

FAQ

How do I make my Discord bot react with a GIF instead of an emoji?

Discord reactions only accept emoji, so the bot sends the GIF as a message attachment or embed image. That message appears right under the original and reads as a reaction.

Do I need a GIF API for a Discord bot?

No. A local folder of GIFs works and is the simplest option. A GIF API or meme search API helps when you want many images without bundling them, but it adds a network call and rate limits.

Why does my bot not see message text?

The message content intent is probably off. Enable it in the Discord developer portal under Bot settings, then pass intents.message_content = True in discord.py or the matching GatewayIntentBits in discord.js.

Can I use web-collected memes in a public bot?

Most web memes are fine for personal chats, but copyright stays with the original creators and they are not for commercial use. For a public or monetized bot, use openly licensed images or make your own.

How do I stop the bot from spamming GIFs?

Add a per-channel cooldown, react only to the first matching word in a message, and ignore other bots. A random chance, such as one in ten matching messages, also keeps it from taking over the chat.