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/ujel.js

24 lines
701 B
JavaScript

let { Command } = require("discord-akairo")
let { MessageAttachment } = require("discord.js")
let fs = require("fs").promises
module.exports = class extends Command {
constructor() {
super("ujel", {
aliases: ["ujel"],
description: "Posts a random troll face image and @s the person specified",
args: [
{
id: "person",
type: "user"
}
],
typing: true
}).usage = "<user>"
}
async exec(message, args) {
let dirlist = await fs.readdir("images/trollfaces")
let randomitem = dirlist[ Math.floor( Math.random() * dirlist.length ) ];
await message.channel.send(String(args.person || message.author), new MessageAttachment(`images/trollfaces/${randomitem}`));
}
}