2021-06-28 19:29:35 +00:00
|
|
|
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(' ');
|
2021-06-28 23:58:46 +00:00
|
|
|
fs.appendFile(`./pastas/${filename}.js`, `module.exports = {\n\tname: '${filename}',\n\tcontent: '${pastaText}'\n}`, function(err) {
|
2021-06-28 19:29:35 +00:00
|
|
|
if (err) throw err;
|
|
|
|
console.log('Saved file!');
|
2021-06-28 23:58:46 +00:00
|
|
|
const pasta = require(`../pastas/${filename}.js`);
|
2021-06-28 19:29:35 +00:00
|
|
|
message.client.pastas.set(pasta.name, pasta);
|
|
|
|
});
|
|
|
|
|
2021-06-28 23:58:46 +00:00
|
|
|
message.reply('GIF saved as: ' + filename + '.pasta!');
|
2021-06-28 19:29:35 +00:00
|
|
|
}
|
2021-06-28 23:58:46 +00:00
|
|
|
}
|