It sends a meme everday in the specific channel that you want you can also you may change the time/frequency by editing the endpoint.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
let time = ``;
let subreddits = [
'dankmemes',
'memes',
'ComedyCemetery',
'PrequelMemes',
'terriblefacebookmemes',
'PewdiepieSubmissions',
'funny',
'AdviceAnimals',
'MemeEconomy',
'meme',
];
function titleCase(str) {
str = str.toLowerCase().split(' ');
for (let i = 0; i < str.length; i++) {
str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);
}
return str.join(' ');
}
let subreddit = subreddits[Math.floor(Math.random() * subreddits.length)];
let link = `https://meme-api.herokuapp.com/gimme/${subreddit}`;
let {data} = await axios(link);
let author = titleCase(data.author);
let title = titleCase(data.title);
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `966382029627347027`, // Put The channel id where you want to send the meme to
content: ``,
tts: false,
embed: {
type: 'rich',
title: ``,
description: '',
color: 0x00ffff,
image: {
url: data.url,
height: 100,
width: 100,
},
footer: {
text: 'Hits : ' + data.ups + '\ud83d\udc4d | Posted By : ' + author,
},
},
});