Adding ability to save new gifs to the hardcode list
This commit is contained in:
parent
b64d687802
commit
ae6627488a
@ -2,6 +2,7 @@ module.exports = {
|
||||
name: "reload-gifs",
|
||||
description: "Refresh the hardcoded gif library.",
|
||||
execute(message, args) {
|
||||
getGifFiles();
|
||||
const index = require('../index.js');
|
||||
index.getGifFiles();
|
||||
}
|
||||
}
|
16
commands/save-gif.js
Normal file
16
commands/save-gif.js
Normal file
@ -0,0 +1,16 @@
|
||||
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');
|
||||
fs.appendFile(`./gifs/${args[0]}.gif`, `module.exports = {\n\tname: '${args[0]}',\n\tembed_url: '${args[1]}'\n}`, function(err) {
|
||||
if (err) throw err;
|
||||
console.log('Saved file!');
|
||||
});
|
||||
}
|
||||
}
|
4
gifs/deeznuts.gif
Normal file
4
gifs/deeznuts.gif
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
name: 'deeznuts',
|
||||
embed_url: 'https://giphy.com/embed/z0XEX0BeuPGmY'
|
||||
}
|
@ -1,3 +1 @@
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
module.exports = {\n\tname: '${args[0]}',\n\tembed_url: '${args[1]}'\n}
|
Loading…
Reference in New Issue
Block a user