nodbot/commands/save-pasta.js
2021-06-28 19:58:46 -04:00

17 lines
588 B
JavaScript

module.exports = {
name: 'save-pasta',
description: 'Adds a given copypasta to the hardcoded list.',
execute(message, args) {
const fs = require('fs');
const filename = args.shift();
const pastaText = args.join(' ');
fs.appendFile(`./pastas/${filename}.js`, `module.exports = {\n\tname: '${filename}',\n\tcontent: '${pastaText}'\n}`, function(err) {
if (err) throw err;
console.log('Saved file!');
const pasta = require(`../pastas/${filename}.js`);
message.client.pastas.set(pasta.name, pasta);
});
message.reply('GIF saved as: ' + filename + '.pasta!');
}
}