This repository has been archived on 2022-10-14. You can view files and clone it, but cannot push or open issues or pull requests.
melonybot/commands/responders/walter.js
2020-04-26 14:07:15 -07:00

18 lines
583 B
JavaScript

let { Command } = require("discord-akairo")
let fs = require('fs').promises
let { MessageAttachment } = require('discord.js')
module.exports = class extends Command {
constructor() {
super("walter", {
regex: /^walter$/i,
description: "Send a random image of Walter the dog",
category: "responders"
})
}
async exec(message, args) {
let dirlist = await fs.readdir("images/walters");
let randomitem = dirlist[ Math.floor( Math.random() * dirlist.length ) ];
await message.channel.send(new MessageAttachment(`images/walters/${randomitem}`));
}
}