From a11666bc4db4c5534cbbd1fd35a8dd42e4297978 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 19:58:46 -0400 Subject: [PATCH] Fixing regular command handling --- commands/save-pasta.js | 8 ++++---- functions.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/save-pasta.js b/commands/save-pasta.js index 31aa252..1dfdaf8 100644 --- a/commands/save-pasta.js +++ b/commands/save-pasta.js @@ -5,13 +5,13 @@ module.exports = { const fs = require('fs'); const filename = args.shift(); const pastaText = args.join(' '); - fs.appendFile(`./pasta/${filename}.js`, `module.exports = {\n\tname: '${filename}',\n\tcontent: '${pastaText}'\n}`, function(err) { + 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(`../pasta/${filename}.js`); + const pasta = require(`../pastas/${filename}.js`); message.client.pastas.set(pasta.name, pasta); }); - message.reply('GIF saved as: ' + args[0] + '.gif!'); + message.reply('GIF saved as: ' + filename + '.pasta!'); } -} \ No newline at end of file +} \ No newline at end of file diff --git a/functions.js b/functions.js index 987997f..f85eb75 100644 --- a/functions.js +++ b/functions.js @@ -31,7 +31,7 @@ module.exports = { if (debug) console.log(client.pastas); }, getExtension(args) { - const finalWord = args.pop(); + const finalWord = args[args.length - 1]; const file = finalWord.split('.'); return file; },