Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is the bots required node modules, certain aspects of the code will not work without this.
- const Discord = require("discord.js");
- const client = new Discord.Client({
- disableEveryone : true,
- fetchAllMembers : true
- });
- const fs = require("fs");
- const snekfetch = require('snekfetch');
- const got = require('got');
- exports.run = async (client, msg, meme) => {
- got('https://www.reddit.com/r/memes/random/.json').then(response => {
- let content = JSON.parse(response.body);
- let permalink = content[0].data.children[0].data.permalink;
- let memeUrl = `https://reddit.com${permalink}`;
- let memeImage = content[0].data.children[0].data.url;
- let memeTitle = content[0].data.children[0].data.title;
- let memeUpvotes = content[0].data.children[0].data.ups;
- let memeDownvotes = content[0].data.children[0].data.downs;
- let memeNumComments = content[0].data.children[0].data.num_comments;
- const embed = new Discord.RichEmbed();
- embed.setTitle("Heres Your Meme!")
- embed.setDescription("You can use the link provided below to Upvote or Downvote the meme")
- embed.addField(`Meme Title:`, `${memeTitle}`);
- embed.addField(`Meme Link`, `[Reddit Memes](${memeUrl})`);
- embed.setImage(memeImage);
- embed.setFooter(`👍 ${memeUpvotes} 👎 ${memeDownvotes} 💬 ${memeNumComments}`);
- msg.delete().catch()
- msg.channel.send(embed)
- })
- };
- exports.conf = {
- enabled: true,
- devLock: false,
- guildOnly: false,
- aliases: ['memes', 'memetime'],
- permLevel: 0
- };
- exports.help = {
- name: 'meme',
- description: 'Generates a random meme',
- usage: '/meme',
- permissions: 'Everyone!',
- group: 'Memes Module'
- };
Add Comment
Please, Sign In to add comment