search for 2 hours, debug for an hour, code for 10 minutes. Finally finish! Use !memegen and bot will show you a meme!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
let link = `https://www.reddit.com/r/memes/random/.json`;
let data = await axios(link).catch((err) => {});
if (!data) return console.log('error');
else data = data.data[0].data.children[0].data.thumbnail;
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `Random meme come!`,
description: '',
color: 0x00ffff,
image: {
url: `${data}`,
height: 0,
width: 0,
},
},
],
});