An API wrapper for Dank Memer API.
npm i --save dankmemer
const DankMemer = require("dankmemer");
const memer = new DankMemer("Your API Token Goes Here");
const DankMemer = require("dankmemer");
const memer = new DankMemer("Dank Memer Api Key");
const Discord = require("discord.js");
const client = new Discord.Client();
client.on("ready", () => {
console.log(`Memer is online!`);
});
client.on("message", async(message) => {
if (!message.guild || message.author.bot) return;
if (message.content === "spank") {
let userone = message.author.displayAvatarURL;
let usertwo = client.user.displayAvatarURL;
let image = await memer.spank(userone, usertwo);
const attachment = new Discord.Attachment(image, "spank.png")
return message.channel.send(attachment);
}
})
client.login("Discord Bot Token");
async function spank(avatar1, avatar2) {
let img = await memer.spank(avatar1, avatar2);
message.channel.send({ file: img });
}
spank();
memer.spank(avatar1, avatar2).then(img => {
message.channel.send({ file: img });
})
Go to dankmemer.services/dashboard and request for API key.
Rate Limits Each endpoint has it's own ratelimit, which you can find in it's documentation. Additionally, the API has a global ratelimit of 300 requests per minute.
The ratelimits for the endpoint are defined with X-RateLimit-:key, while the global ratelimit is defined with X-Global-RateLimit-:key. When the global ratelimit is hit, the body will contain an additional JSON key "global" which will be set to true.