I am new to working with APIs in discord.js and I stumbled across a meme API in npm (https://www.npmjs.com/package/something-random-on-discord). I followed the exact steps on the site and got this error:
/home/runner/Penguin69/node_modules/discord.js/src/rest/RequestHandler.js:349
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/home/runner/Penguin69/node_modules/discord.js/src/rest/RequestHandler.js:349:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/runner/Penguin69/node_modules/discord.js/src/rest/RequestHandler.js:50:14) {
method: 'post',
path: '/channels/914839917769658371/messages',
code: 50006,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
my code was:
const random = require("something-random-on-discord").Random
client.on("messageCreate", message => {
if (message.content.toLowerCase() === "!meme") {
let data = await random.getMeme()
message.channel.send(data)
};
});
Does this have something to do with me using discord.js v13? If so, is there any other meme API/generator that works? Hope someone can help!