2021-06-28 02:19:16 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'save-gif',
|
|
|
|
description: 'Adds a given gif to the hardcoded list.',
|
|
|
|
execute(message, args) {
|
|
|
|
if (args.length != 2) {
|
|
|
|
message.reply('This command requires exactly two arguments, gif name and url. Please try again.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const fs = require('fs');
|
2021-06-28 03:20:21 +00:00
|
|
|
fs.appendFile(`./gifs/${args[0]}.js`, `module.exports = {\n\tname: '${args[0]}',\n\tembed_url: '${args[1]}'\n}`, function(err) {
|
2021-06-28 02:19:16 +00:00
|
|
|
if (err) throw err;
|
|
|
|
console.log('Saved file!');
|
2021-06-28 03:20:21 +00:00
|
|
|
const gif = require(`../gifs/${args[0]}.js`);
|
|
|
|
message.client.gifs.set(gif.name, gif);
|
2021-06-28 02:19:16 +00:00
|
|
|
});
|
2021-06-28 03:20:21 +00:00
|
|
|
|
|
|
|
message.reply('GIF saved as: ' + args[0] + '.gif!');
|
2021-06-28 02:19:16 +00:00
|
|
|
}
|
|
|
|
}
|