2020-12-27 12:57:35 +00:00
|
|
|
const Discord = require('discord.js');
|
|
|
|
const fs = require('fs').promises;
|
|
|
|
|
|
|
|
module.exports.meta = {
|
|
|
|
name: 'copypasta',
|
|
|
|
aliases: ['pasta'],
|
|
|
|
staffOnly: false,
|
|
|
|
epicOnly: true
|
|
|
|
}
|
|
|
|
|
2020-12-27 12:59:54 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {Discord.Message} message
|
|
|
|
* @param {Array<string>} args
|
|
|
|
*/
|
2020-12-27 12:57:35 +00:00
|
|
|
module.exports.run = async (message, args) => {
|
|
|
|
let copypastas = await fs.readdir(__dirname + '/copypastas');
|
|
|
|
let pasta = copypastas.find((p) => p.toLowerCase() == args[0]?.toLowerCase());
|
|
|
|
|
|
|
|
if (!pasta) {
|
|
|
|
message.channel.send(`Please choose one of: \`${copypastas.join('`, `')}\``);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let lines = (await fs.readFile(__dirname + '/copypastas/' + pasta))
|
|
|
|
.toString('utf-8')
|
|
|
|
.split('\n');
|
|
|
|
|
2020-12-27 12:59:54 +00:00
|
|
|
lines.forEach(async line => {
|
2020-12-27 12:57:35 +00:00
|
|
|
await message.channel.send(line, { tts: true });
|
|
|
|
});
|
|
|
|
}
|