From 6dd9aec909e0a62bf50cafe8266177c037d5e1ce Mon Sep 17 00:00:00 2001 From: = Date: Fri, 9 Jul 2021 23:24:13 -0400 Subject: [PATCH] Making saveGifs a function instead of command --- functions.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/functions.js b/functions.js index 74bd9f2..cb13ffc 100644 --- a/functions.js +++ b/functions.js @@ -52,5 +52,13 @@ module.exports = { .setImage(data.embed_url) .setTimestamp() .setFooter('@' + data.author.username + '#' + data.author.discriminator); + }, + saveGif(message, name, embed_url) { + fs.writeFile(`./gifs/${name}.js`, `module.exports = {\n\tname: '${name}',\n\tembed_url: '${embed_url}'\n}`, function(err) { + if (err) throw err; + console.log('Saved file!'); + const gif = require(`../gifs/${name}.js`); + message.client.gifs.set(gif.name, gif); + }); } } \ No newline at end of file