nyx/commands/Fun/dog.js

31 lines
976 B
JavaScript
Raw Normal View History

2021-06-12 12:53:51 +02:00
const api = require("imageapi.js");
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "dog",
aliases: ["dogs"],
category: "Fun",
description: "A dog command",
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
const wait = await message.inlineReply("Getting dog picture...");
let subreddits = ["dog", "dogs"];
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 dog picture 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 });
},
};