Making saveGifs a function instead of command

This commit is contained in:
= 2021-07-09 23:24:13 -04:00
parent 6d8023ad9f
commit 6dd9aec909

View File

@ -52,5 +52,13 @@ module.exports = {
.setImage(data.embed_url) .setImage(data.embed_url)
.setTimestamp() .setTimestamp()
.setFooter('@' + data.author.username + '#' + data.author.discriminator); .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);
});
} }
} }