Advertisement
lollolooloo

meme discord bot script

Apr 3rd, 2022
995
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.30 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const { MessageEmbed } = require("discord.js");
  3. const Color = `RANDOM`;
  4. const Fetch = require("node-fetch"); //Install Node-fetch - npm i node-fetch
  5.  
  6. module.exports = {
  7.     name: "meme",
  8.     category: "fun",
  9.     description: "Send A Meme!",
  10.     usage: "Meme",
  11.     run: async (client, message, args) => {
  12.  
  13.         //Start
  14.  
  15.         const Reds = [
  16.             "memes",
  17.             "me_irl",
  18.             "dankmemes",
  19.             "comedyheaven",
  20.             "Animemes"
  21.         ];
  22.  
  23.         const Rads = Reds[Math.floor(Math.random() * Reds.length)];
  24.  
  25.         const res = await Fetch(`https://www.reddit.com/r/${Rads}/random/.json`);
  26.  
  27.         const json = await res.json();
  28.  
  29.         if (!json[0]) return message.channel.send(`Your Life Lmfao`);
  30.  
  31.         const data = json[0].data.children[0].data;
  32.  
  33.         const Embed = new MessageEmbed()
  34.             .setColor(Color)
  35.             .setURL(`https://reddit.com${data.permalink}`)
  36.             .setTitle(data.title)
  37.             .setDescription(`Author : ${data.author}`)
  38.             .setImage(data.url)
  39.             .setFooter(`${data.ups || 0} 👍 | ${data.downs || 0} 👎 | ${data.num_comments || 0} 💬`)
  40.             .setTimestamp();
  41.  
  42.         return message.channel.send(Embed);
  43.  
  44.         //End
  45.  
  46.     }
  47. };
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement