nyx/commands/Fun/meme.js
night0721 bc346138dd Bot
2021-06-12 18:53:51 +08:00

30 lines
991 B
JavaScript

const api = require("imageapi.js");
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "meme",
aliases: ["memes"],
category: "Fun",
description: "A meme command",
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
const wait = await message.inlineReply("Getting meme...");
let subreddits = ["comedyheaven", "dank", "meme", "memes"];
let subreddit = subreddits[Math.floor(Math.random() * subreddits.length)];
const img = await api(subreddit).catch(err => console.log(err));
const Embed = new MessageEmbed()
.setTitle(`A meme from r/${subreddit}`)
.setURL(`https://reddit.com/r/${subreddit}`)
.setColor(client.color)
.setImage(img)
.setTimestamp()
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
);
wait.edit("", { embed: Embed });
},
};