This repository has been archived on 2022-10-14. You can view files and clone it, but cannot push or open issues/pull-requests.
melonybot/commands/stock.js

15 lines
486 B
JavaScript

var fs = require("fs").promises
module.exports = class extends Akairo.Command {
constructor() {
super("stock", {
aliases: ["stock"],
description: "Posts a random stock image.",
typing: true
})
}
async exec(message, args) {
let dirlist = await fs.readdir("images/stock-images");
let randomitem = dirlist[ Math.floor( Math.random() * dirlist.length ) ];
await message.channel.send(new Discord.MessageAttachment(`images/stock-images/${randomitem}`));
}
}