From abe1097c0c5f229adad2f43eedc992d274fcafe6 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 27 Jun 2021 19:41:25 -0400 Subject: [PATCH 01/18] Initial Refactor *UNUSABLE* --- commands/help.js | 43 +++++++++++++++++ commands/log-message.js | 7 +++ commands/ping.js | 7 +++ commands/request.js | 9 ++++ commands/template | 7 +++ commands/truth.js | 7 +++ commands/wrongbad.js | 9 ++++ config.json | 4 ++ index.js | 100 ++++++++++++++++------------------------ 9 files changed, 133 insertions(+), 60 deletions(-) create mode 100644 commands/help.js create mode 100644 commands/log-message.js create mode 100644 commands/ping.js create mode 100644 commands/request.js create mode 100644 commands/template create mode 100644 commands/truth.js create mode 100644 commands/wrongbad.js create mode 100644 config.json diff --git a/commands/help.js b/commands/help.js new file mode 100644 index 0000000..26be304 --- /dev/null +++ b/commands/help.js @@ -0,0 +1,43 @@ +const { prefix } = require('../config.json'); + +module.exports = { + name: 'help', + description: 'Shows the help page.', + execute(message, args) { + const data = []; + const { commands } = message.client; + + if (!args.length) { + data.push('Here\'s a list of all my commands:'); + data.push(commands.map(command => command.name).join(', ')); + data.push(`\nYou can send \`${prefix}help [command name]\` to get info on a specific command!`); + + return message.author.send(data, { split: true }) + .then(() => { + if (message.channel.type === 'dm') return; + message.reply('I\'ve sent you a DM with all my commands!'); + }) + .catch(error => { + console.error(`Could not send help DM to ${message.author.tag}.\n`, error); + message.reply('it seems like I can\'t DM you! Do you have DMs disabled?'); + }); + } + + const name = args[0].toLowerCase(); + const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name)); + + if (!command) { + return message.reply('that\'s not a valid command!'); + } + + data.push(`**Name:** ${command.name}`); + + if (command.aliases) data.push(`**Aliases:** ${command.aliases.join(', ')}`); + if (command.description) data.push(`**Description:** ${command.description}`); + if (command.usage) data.push(`**Usage:** ${prefix}${command.name} ${command.usage}`); + + data.push(`**Cooldown:** ${command.cooldown || 3} second(s)`); + + message.channel.send(data, { split: true }); + }, +}; \ No newline at end of file diff --git a/commands/log-message.js b/commands/log-message.js new file mode 100644 index 0000000..fbbb02a --- /dev/null +++ b/commands/log-message.js @@ -0,0 +1,7 @@ +module.exports = { + name: "log-message", + description: "Logs the message to console for debugging purposes.", + execute(message, args) { + console.log(message); + } +} \ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js new file mode 100644 index 0000000..eb270b5 --- /dev/null +++ b/commands/ping.js @@ -0,0 +1,7 @@ +module.exports = { + name: 'ping', + description: 'Ping!', + execute(message, args) { + message.channel.send('Pong.'); + } +} \ No newline at end of file diff --git a/commands/request.js b/commands/request.js new file mode 100644 index 0000000..03696cb --- /dev/null +++ b/commands/request.js @@ -0,0 +1,9 @@ +module.exports = { + name: 'request', + description: 'Submit a request to the bot developer.', + execute(message, args) { + const request = args.join(' '); + message.channel.send('Your request has been submitted:\n```\n' + request + '\n```'); + message.client.users.fetch(process.env.ownerID).then(user => {user.send('New request or feedback:\n```\n' + request + '\n```');}).catch(error => { console.error(error);} ); + } +} \ No newline at end of file diff --git a/commands/template b/commands/template new file mode 100644 index 0000000..e87841d --- /dev/null +++ b/commands/template @@ -0,0 +1,7 @@ +module.exports = { + name: "", + description: "", + execute(message, args) { + message.channel.send(""); + } +} \ No newline at end of file diff --git a/commands/truth.js b/commands/truth.js new file mode 100644 index 0000000..fab5c0c --- /dev/null +++ b/commands/truth.js @@ -0,0 +1,7 @@ +module.exports = { + name: "truth", + description: "The truth about MHFS", + execute(message, args) { + message.channel.send("https://www.twitch.tv/hochmania/clip/EsteemedSlickDootStinkyCheese-hncmP8aIP8_WQb_a?filter=clips&range=all&sort=time"); + } +} \ No newline at end of file diff --git a/commands/wrongbad.js b/commands/wrongbad.js new file mode 100644 index 0000000..df735d6 --- /dev/null +++ b/commands/wrongbad.js @@ -0,0 +1,9 @@ +module.exports = { + name: "wrongbad", + description: "", + execute(message, args) { + + const wrongbad = "<:wrongbad:853304921969393684>"; + message.channel.send(""); + } +} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..7b3bac1 --- /dev/null +++ b/config.json @@ -0,0 +1,4 @@ +{ + "prefix": "/", + "serverID": "760701839427108874" +} \ No newline at end of file diff --git a/index.js b/index.js index ff2dfdd..503eefb 100644 --- a/index.js +++ b/index.js @@ -1,80 +1,60 @@ /* eslint-disable brace-style */ // Variable Assignment +const fs = require('fs'); const dotenv = require('dotenv'); +dotenv.config(); const Discord = require('discord.js'); const client = new Discord.Client(); -const giphy = require('giphy-api')(process.env.giphyAPIKey); -const debug = false; -const links = require('./links.json'); +client.commands = new Discord.Collection(); +const debug = true; +const config = require('./config.json'); +const { prefix, serverID } = require('./config.json'); +const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); +// const owner = process.env.ownerID; -dotenv.config(); -const owner = process.env.ownerID; +function getCommandFiles() { + for (const file of commandFiles) { + const command = require(`./commands/${file}`); + client.commands.set(command.name, command); + } + if (debug) console.log(client.commands); +} -if (debug) { - console.log(links); +function extCheck(content) { + const lastFour = content.slice(-4); + switch (lastFour) { + case '.gif': + return 'gif'; + case '.jpg': + return 'jpg'; + default: + return false; + } } client.once('ready', () => { console.log('Ready'); + client.guilds.fetch(serverID) + .then(guild => client.user.setActivity('Nod Simulator 2021', {type: "PLAYING"})) + .catch(console.error); + getCommandFiles(); }); client.login(process.env.TOKEN); client.on('message', message => { - if (message.author.bot) return; + if (debug) console.log(extCheck(message.content)); + if (!message.content.startsWith(prefix) || message.author.bot || !extCheck(message.content)) return; - const pre = message.content.slice(0, -4); - const ext = message.content.slice(-4); - let gifFound = false; + const args = message.content.slice(prefix.length).trim().split(/ +/); + const command = args.shift().toLowerCase(); - switch (ext) { - case '.gif': - if (debug) { - console.log('pre: ' + pre); - console.log('ext: ' + ext); - } - for (let index = 0; index < links.gifs.length; index++) { - const gif = links.gifs[index]; - if (gif.name == pre) { - message.channel.send(gif.embed_url); - gifFound = true; - } - } - if (gifFound == false) { - try { - giphy.search(pre, function(err, res) { - if (res.data[0] != undefined) { - message.channel.send(res.data[0].embed_url); - } else { - message.channel.send('Sorry, I was unable to find a gif of ' + pre + '.'); - } - if (err) { - console.log(err); - } - }); - } catch (error) { - console.log(error); - } - } - break; - // Admin Commands - case '.adm': - if (message.member.id == process.env.ownerID) { - switch (pre) { - case 'kill': - client.destroy(); - process.exit(); - break; - default: - break; - } - } - break; - case '.req': - message.channel.send('Feedback Submitted: ' + pre); - client.users.fetch(owner).then(user => { user.send('Feedback/Request: ' + pre);}); - break; - default: - break; + if (!client.commands.has(command)) return; + + try { + client.commands.get(command).execute(message, args); + } catch (error) { + console.error(error); + message.reply('There was an error trying to execute that command.'); } }); \ No newline at end of file From b64d687802b997a8144780c35422596c936dcb5d Mon Sep 17 00:00:00 2001 From: = Date: Sun, 27 Jun 2021 20:24:58 -0400 Subject: [PATCH 02/18] setting up gif Collection and getting bot functional --- commands/reload-gifs.js | 7 +++++ gifs/dab.js | 4 +++ gifs/nod.js | 4 +++ gifs/psh.js | 4 +++ gifs/shedsalive.js | 4 +++ gifs/shedsdead.js | 4 +++ gifs/template | 3 ++ index.js | 61 +++++++++++++++++++++++++++++++---------- 8 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 commands/reload-gifs.js create mode 100644 gifs/dab.js create mode 100644 gifs/nod.js create mode 100644 gifs/psh.js create mode 100644 gifs/shedsalive.js create mode 100644 gifs/shedsdead.js create mode 100644 gifs/template diff --git a/commands/reload-gifs.js b/commands/reload-gifs.js new file mode 100644 index 0000000..ce63611 --- /dev/null +++ b/commands/reload-gifs.js @@ -0,0 +1,7 @@ +module.exports = { + name: "reload-gifs", + description: "Refresh the hardcoded gif library.", + execute(message, args) { + getGifFiles(); + } +} \ No newline at end of file diff --git a/gifs/dab.js b/gifs/dab.js new file mode 100644 index 0000000..12e46a4 --- /dev/null +++ b/gifs/dab.js @@ -0,0 +1,4 @@ +module.exports = { + name: "dab", + embed_url: "https://giphy.com/embed/lae7QSMFxEkkE" +} \ No newline at end of file diff --git a/gifs/nod.js b/gifs/nod.js new file mode 100644 index 0000000..23eb602 --- /dev/null +++ b/gifs/nod.js @@ -0,0 +1,4 @@ +module.exports = { + name: "nod", + embed_url: "https://tenor.com/view/smile-nod-yes-robert-redford-beard-gif-10489927" +} \ No newline at end of file diff --git a/gifs/psh.js b/gifs/psh.js new file mode 100644 index 0000000..dfd3885 --- /dev/null +++ b/gifs/psh.js @@ -0,0 +1,4 @@ +module.exports = { + name: "psh", + embed_url: "https://tenor.com/view/ed-bassmaster-youtuber-youtube-influencer-psh-gif-10556767" +} \ No newline at end of file diff --git a/gifs/shedsalive.js b/gifs/shedsalive.js new file mode 100644 index 0000000..49e998f --- /dev/null +++ b/gifs/shedsalive.js @@ -0,0 +1,4 @@ +module.exports = { + name: "shedsalive", + embed_url: "https://giphy.com/embed/glL1yvxJ4KvYc" +} \ No newline at end of file diff --git a/gifs/shedsdead.js b/gifs/shedsdead.js new file mode 100644 index 0000000..ca3c725 --- /dev/null +++ b/gifs/shedsdead.js @@ -0,0 +1,4 @@ +module.exports = { + name: "shedsdead", + embed_url: "http://voidf1sh.me/shedsdead.gif" +} \ No newline at end of file diff --git a/gifs/template b/gifs/template new file mode 100644 index 0000000..1df103a --- /dev/null +++ b/gifs/template @@ -0,0 +1,3 @@ +module.exports = { + +} \ No newline at end of file diff --git a/index.js b/index.js index 503eefb..c977f2e 100644 --- a/index.js +++ b/index.js @@ -6,11 +6,14 @@ dotenv.config(); const Discord = require('discord.js'); const client = new Discord.Client(); client.commands = new Discord.Collection(); +client.gifs = new Discord.Collection(); const debug = true; -const config = require('./config.json'); -const { prefix, serverID } = require('./config.json'); +// const config = require('./config.json'); +const { prefix } = require('./config.json'); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); +const gifFiles = fs.readdirSync('./gifs').filter(file => file.endsWith('.js')); // const owner = process.env.ownerID; +const giphy = require('giphy-api')(process.env.giphyAPIKey); function getCommandFiles() { for (const file of commandFiles) { @@ -20,6 +23,14 @@ function getCommandFiles() { if (debug) console.log(client.commands); } +function getGifFiles() { + for (const file of gifFiles) { + const gif = require(`./gifs/${file}`); + client.gifs.set(gif.name, gif); + } + if (debug) console.log(client.gifs); +} + function extCheck(content) { const lastFour = content.slice(-4); switch (lastFour) { @@ -34,27 +45,47 @@ function extCheck(content) { client.once('ready', () => { console.log('Ready'); - client.guilds.fetch(serverID) - .then(guild => client.user.setActivity('Nod Simulator 2021', {type: "PLAYING"})) - .catch(console.error); + client.user.setActivity('Nod Simulator 2021', { type: 'PLAYING' }).then().catch(console.error); getCommandFiles(); + getGifFiles(); }); client.login(process.env.TOKEN); client.on('message', message => { - if (debug) console.log(extCheck(message.content)); - if (!message.content.startsWith(prefix) || message.author.bot || !extCheck(message.content)) return; + const ext = extCheck(message.content); + if (debug) console.log(ext); + if ((!message.content.startsWith(prefix) && ext == false) || message.author.bot) return; - const args = message.content.slice(prefix.length).trim().split(/ +/); - const command = args.shift().toLowerCase(); + if (message.content.startsWith(prefix)) { + const args = message.content.slice(prefix.length).trim().split(/ +/); + const command = args.shift().toLowerCase(); - if (!client.commands.has(command)) return; + if (!client.commands.has(command)) return; - try { - client.commands.get(command).execute(message, args); - } catch (error) { - console.error(error); - message.reply('There was an error trying to execute that command.'); + try { + client.commands.get(command).execute(message, args); + } catch (error) { + console.error(error); + message.channel.send('There was an error trying to execute that command.'); + } + } + + if (ext == 'gif') { + const query = message.content.slice(0, -4); + if (debug) console.log(query); + + if (!client.gifs.has(query)) { + giphy.search(query, (err, res) => { + if (res.data[0] != undefined) { + message.channel.send(res.data[0].embed_url).then().catch(console.error); + } else { + message.channel.send('I was unable to find a gif of ' + query); + } + if (err) console.error(err); + }); + } else { + message.channel.send(client.gifs.get(query).embed_url); + } } }); \ No newline at end of file From ae6627488acd30c61ed6a3029a105b820a43731b Mon Sep 17 00:00:00 2001 From: = Date: Sun, 27 Jun 2021 22:19:16 -0400 Subject: [PATCH 03/18] Adding ability to save new gifs to the hardcode list --- commands/reload-gifs.js | 3 ++- commands/save-gif.js | 16 ++++++++++++++++ gifs/deeznuts.gif | 4 ++++ gifs/template | 4 +--- index.js | 1 + 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 commands/save-gif.js create mode 100644 gifs/deeznuts.gif diff --git a/commands/reload-gifs.js b/commands/reload-gifs.js index ce63611..70be76a 100644 --- a/commands/reload-gifs.js +++ b/commands/reload-gifs.js @@ -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(); } } \ No newline at end of file diff --git a/commands/save-gif.js b/commands/save-gif.js new file mode 100644 index 0000000..c036341 --- /dev/null +++ b/commands/save-gif.js @@ -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!'); + }); + } +} \ No newline at end of file diff --git a/gifs/deeznuts.gif b/gifs/deeznuts.gif new file mode 100644 index 0000000..c894853 --- /dev/null +++ b/gifs/deeznuts.gif @@ -0,0 +1,4 @@ +module.exports = { + name: 'deeznuts', + embed_url: 'https://giphy.com/embed/z0XEX0BeuPGmY' +} \ No newline at end of file diff --git a/gifs/template b/gifs/template index 1df103a..e767e5d 100644 --- a/gifs/template +++ b/gifs/template @@ -1,3 +1 @@ -module.exports = { - -} \ No newline at end of file +module.exports = {\n\tname: '${args[0]}',\n\tembed_url: '${args[1]}'\n} \ No newline at end of file diff --git a/index.js b/index.js index c977f2e..722b142 100644 --- a/index.js +++ b/index.js @@ -61,6 +61,7 @@ client.on('message', message => { const args = message.content.slice(prefix.length).trim().split(/ +/); const command = args.shift().toLowerCase(); + if (debug) console.log(args); if (!client.commands.has(command)) return; try { From 153af5008d96b2230463752ce1f3c6fa2a5dac1a Mon Sep 17 00:00:00 2001 From: = Date: Sun, 27 Jun 2021 23:20:21 -0400 Subject: [PATCH 04/18] add ability to save gifs in chat --- commands/reload-gifs.js | 5 ++-- commands/save-gif.js | 6 ++++- functions.js | 35 +++++++++++++++++++++++++ gifs/bobsaget.js | 4 +++ gifs/cumb.js | 4 +++ gifs/{deeznuts.gif => deeznuts.js} | 0 gifs/shid.js | 4 +++ index.js | 41 +++++------------------------- 8 files changed, 61 insertions(+), 38 deletions(-) create mode 100644 functions.js create mode 100644 gifs/bobsaget.js create mode 100644 gifs/cumb.js rename gifs/{deeznuts.gif => deeznuts.js} (100%) create mode 100644 gifs/shid.js diff --git a/commands/reload-gifs.js b/commands/reload-gifs.js index 70be76a..2cf85c3 100644 --- a/commands/reload-gifs.js +++ b/commands/reload-gifs.js @@ -1,8 +1,9 @@ +/* eslint-disable quotes */ module.exports = { name: "reload-gifs", description: "Refresh the hardcoded gif library.", execute(message, args) { - const index = require('../index.js'); - index.getGifFiles(); + const functions = require('../functions.js'); + functions.getGifFiles(message.client); } } \ No newline at end of file diff --git a/commands/save-gif.js b/commands/save-gif.js index c036341..3da3aa9 100644 --- a/commands/save-gif.js +++ b/commands/save-gif.js @@ -8,9 +8,13 @@ module.exports = { } const fs = require('fs'); - fs.appendFile(`./gifs/${args[0]}.gif`, `module.exports = {\n\tname: '${args[0]}',\n\tembed_url: '${args[1]}'\n}`, function(err) { + fs.appendFile(`./gifs/${args[0]}.js`, `module.exports = {\n\tname: '${args[0]}',\n\tembed_url: '${args[1]}'\n}`, function(err) { if (err) throw err; console.log('Saved file!'); + const gif = require(`../gifs/${args[0]}.js`); + message.client.gifs.set(gif.name, gif); }); + + message.reply('GIF saved as: ' + args[0] + '.gif!'); } } \ No newline at end of file diff --git a/functions.js b/functions.js new file mode 100644 index 0000000..53576dc --- /dev/null +++ b/functions.js @@ -0,0 +1,35 @@ +const Discord = require('discord.js'); +const fs = require('fs'); +const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); +const gifFiles = fs.readdirSync('./gifs').filter(file => file.endsWith('.js')); +const debug = true; + +module.exports = { + getCommandFiles(client) { + client.commands = new Discord.Collection(); + for (const file of commandFiles) { + const command = require(`./commands/${file}`); + client.commands.set(command.name, command); + } + if (debug) console.log(client.commands); + }, + getGifFiles(client) { + client.gifs = new Discord.Collection(); + for (const file of gifFiles) { + const gif = require(`./gifs/${file}`); + client.gifs.set(gif.name, gif); + } + if (debug) console.log(client.gifs); + }, + extCheck(content) { + const lastFour = content.slice(-4); + switch (lastFour) { + case '.gif': + return 'gif'; + case '.jpg': + return 'jpg'; + default: + return false; + } + } +} \ No newline at end of file diff --git a/gifs/bobsaget.js b/gifs/bobsaget.js new file mode 100644 index 0000000..0866e6b --- /dev/null +++ b/gifs/bobsaget.js @@ -0,0 +1,4 @@ +module.exports = { + name: 'bobsaget', + embed_url: 'https://tenor.com/view/bob-saget-tourettes-mad-angry-gif-8840899' +} \ No newline at end of file diff --git a/gifs/cumb.js b/gifs/cumb.js new file mode 100644 index 0000000..d11fbe3 --- /dev/null +++ b/gifs/cumb.js @@ -0,0 +1,4 @@ +module.exports = { + name: 'cumb', + embed_url: 'https://tenor.com/view/sperm-gif-gif-13292476' +} \ No newline at end of file diff --git a/gifs/deeznuts.gif b/gifs/deeznuts.js similarity index 100% rename from gifs/deeznuts.gif rename to gifs/deeznuts.js diff --git a/gifs/shid.js b/gifs/shid.js new file mode 100644 index 0000000..f9ec0a2 --- /dev/null +++ b/gifs/shid.js @@ -0,0 +1,4 @@ +module.exports = { + name: 'shid', + embed_url: 'https://tenor.com/view/sheet-gif-19721309' +} \ No newline at end of file diff --git a/index.js b/index.js index 722b142..2301862 100644 --- a/index.js +++ b/index.js @@ -1,59 +1,30 @@ /* eslint-disable brace-style */ // Variable Assignment -const fs = require('fs'); const dotenv = require('dotenv'); dotenv.config(); const Discord = require('discord.js'); const client = new Discord.Client(); -client.commands = new Discord.Collection(); -client.gifs = new Discord.Collection(); + const debug = true; // const config = require('./config.json'); const { prefix } = require('./config.json'); -const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); -const gifFiles = fs.readdirSync('./gifs').filter(file => file.endsWith('.js')); + // const owner = process.env.ownerID; const giphy = require('giphy-api')(process.env.giphyAPIKey); +const functions = require('./functions.js'); -function getCommandFiles() { - for (const file of commandFiles) { - const command = require(`./commands/${file}`); - client.commands.set(command.name, command); - } - if (debug) console.log(client.commands); -} - -function getGifFiles() { - for (const file of gifFiles) { - const gif = require(`./gifs/${file}`); - client.gifs.set(gif.name, gif); - } - if (debug) console.log(client.gifs); -} - -function extCheck(content) { - const lastFour = content.slice(-4); - switch (lastFour) { - case '.gif': - return 'gif'; - case '.jpg': - return 'jpg'; - default: - return false; - } -} client.once('ready', () => { console.log('Ready'); client.user.setActivity('Nod Simulator 2021', { type: 'PLAYING' }).then().catch(console.error); - getCommandFiles(); - getGifFiles(); + functions.getCommandFiles(client); + functions.getGifFiles(client); }); client.login(process.env.TOKEN); client.on('message', message => { - const ext = extCheck(message.content); + const ext = functions.extCheck(message.content); if (debug) console.log(ext); if ((!message.content.startsWith(prefix) && ext == false) || message.author.bot) return; From 44d41405d84d5652ab578dafd9b4ef273c022c25 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 27 Jun 2021 23:30:47 -0400 Subject: [PATCH 05/18] Excluding the custom gifs folder --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 2301862..b2db80a 100644 --- a/index.js +++ b/index.js @@ -40,6 +40,7 @@ client.on('message', message => { } catch (error) { console.error(error); message.channel.send('There was an error trying to execute that command.'); + message.guild.owner } } From c5ef82daa09eb58bf487d8f4a0c97ede69d06483 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 15:28:16 -0400 Subject: [PATCH 06/18] BROKEN --- index.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index b2db80a..cd9338c 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const debug = true; // const config = require('./config.json'); const { prefix } = require('./config.json'); -// const owner = process.env.ownerID; +// const owner = process.env.ownerID; const giphy = require('giphy-api')(process.env.giphyAPIKey); const functions = require('./functions.js'); @@ -19,18 +19,18 @@ client.once('ready', () => { client.user.setActivity('Nod Simulator 2021', { type: 'PLAYING' }).then().catch(console.error); functions.getCommandFiles(client); functions.getGifFiles(client); + functions.getPastaFiles(client); }); client.login(process.env.TOKEN); client.on('message', message => { - const ext = functions.extCheck(message.content); - if (debug) console.log(ext); - if ((!message.content.startsWith(prefix) && ext == false) || message.author.bot) return; + const args = message.content.trim().split(/ +/); + const extension = functions.getExtension(args); + if ((!message.content.startsWith(prefix) && extension != undefined) || message.author.bot) return; if (message.content.startsWith(prefix)) { - const args = message.content.slice(prefix.length).trim().split(/ +/); - const command = args.shift().toLowerCase(); + const command = args.shift().toLowerCase().slice(prefix.length); if (debug) console.log(args); if (!client.commands.has(command)) return; @@ -44,8 +44,9 @@ client.on('message', message => { } } - if (ext == 'gif') { - const query = message.content.slice(0, -4); + const query = message.content.slice(0, -4); + switch (extension) { + case '.gif': if (debug) console.log(query); if (!client.gifs.has(query)) { @@ -60,5 +61,18 @@ client.on('message', message => { } else { message.channel.send(client.gifs.get(query).embed_url); } + break; + case '.pasta': + const pastaName = args[0].splice(args[0].search(/\.(?:.(?!\\))+$/gim)) + if (debug) console.log(query); + + if (!client.pastas.has(query)) { + message.reply('Sorry I couldn\'t find that gif.'); + } else { + message.channel.send(client.pastas.get(query).content); + } + break; + default: + break; } }); \ No newline at end of file From 232244068acc35ef8f4dd57717c158e62419d68b Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 15:29:35 -0400 Subject: [PATCH 07/18] Broken --- .gitignore | 4 ++++ commands/get-ext.js | 10 ++++++++++ commands/save-pasta.js | 17 +++++++++++++++++ functions.js | 16 ++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 commands/get-ext.js create mode 100644 commands/save-pasta.js diff --git a/.gitignore b/.gitignore index dddcac2..cdc3e4e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,10 @@ .vscode .eslintrc.json +# Custom folders +gifs/* +pastas/* + # Logs logs *.log diff --git a/commands/get-ext.js b/commands/get-ext.js new file mode 100644 index 0000000..34db506 --- /dev/null +++ b/commands/get-ext.js @@ -0,0 +1,10 @@ +module.exports = { + name: "get-ext", + description: "Test function to capture the extension from the content of a message.", + execute(message, args) { + const finalWord = args.pop(); + const file = finalWord.split('.'); + console.log(file); + message.reply('The extension is: ' + file[1] + '\nThe filename is: ' + file[0]); + } +} \ No newline at end of file diff --git a/commands/save-pasta.js b/commands/save-pasta.js new file mode 100644 index 0000000..31aa252 --- /dev/null +++ b/commands/save-pasta.js @@ -0,0 +1,17 @@ +module.exports = { + name: 'save-pasta', + description: 'Adds a given copypasta to the hardcoded list.', + execute(message, args) { + 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) { + if (err) throw err; + console.log('Saved file!'); + const pasta = require(`../pasta/${filename}.js`); + message.client.pastas.set(pasta.name, pasta); + }); + + message.reply('GIF saved as: ' + args[0] + '.gif!'); + } +} \ No newline at end of file diff --git a/functions.js b/functions.js index 53576dc..b886733 100644 --- a/functions.js +++ b/functions.js @@ -2,6 +2,7 @@ const Discord = require('discord.js'); const fs = require('fs'); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); const gifFiles = fs.readdirSync('./gifs').filter(file => file.endsWith('.js')); +const pastaFiles = fs.readdirSync('./pastas').filter(file => file.endsWith('.js')); const debug = true; module.exports = { @@ -21,6 +22,19 @@ module.exports = { } if (debug) console.log(client.gifs); }, + getPastaFiles(client) { + client.pasta = new Discord.Collection(); + for (const file of pastaFiles) { + const pasta = require(`./pasta/${file}`); + client.pastas.set(pasta.name, pasta); + } + if (debug) console.log(client.pastas); + }, + getExtension(args) { + const finalWord = args.pop(); + const file = finalWord.split('.'); + return file[1]; + }, extCheck(content) { const lastFour = content.slice(-4); switch (lastFour) { @@ -28,6 +42,8 @@ module.exports = { return 'gif'; case '.jpg': return 'jpg'; + case '.pst': + return 'pst'; default: return false; } From 52327a897d9ea634e9213e25dcaf43ead1d4457b Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 18:11:32 -0400 Subject: [PATCH 08/18] Changing extension handling --- functions.js | 6 ++--- index.js | 71 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/functions.js b/functions.js index b886733..987997f 100644 --- a/functions.js +++ b/functions.js @@ -23,9 +23,9 @@ module.exports = { if (debug) console.log(client.gifs); }, getPastaFiles(client) { - client.pasta = new Discord.Collection(); + client.pastas = new Discord.Collection(); for (const file of pastaFiles) { - const pasta = require(`./pasta/${file}`); + const pasta = require(`./pastas/${file}`); client.pastas.set(pasta.name, pasta); } if (debug) console.log(client.pastas); @@ -33,7 +33,7 @@ module.exports = { getExtension(args) { const finalWord = args.pop(); const file = finalWord.split('.'); - return file[1]; + return file; }, extCheck(content) { const lastFour = content.slice(-4); diff --git a/index.js b/index.js index cd9338c..03f1ebc 100644 --- a/index.js +++ b/index.js @@ -26,53 +26,64 @@ client.login(process.env.TOKEN); client.on('message', message => { const args = message.content.trim().split(/ +/); - const extension = functions.getExtension(args); - if ((!message.content.startsWith(prefix) && extension != undefined) || message.author.bot) return; + // TODO this will surely break something when trying to use non-filename commands + const file = functions.getExtension(args); + // If the message is from a bot, or doesn't have the prefix or a file extension, stop here. + if ((!message.content.startsWith(prefix) && file[1] == undefined) || message.author.bot) return; + // If the message starts with the prefix, if (message.content.startsWith(prefix)) { + // Extract the command const command = args.shift().toLowerCase().slice(prefix.length); if (debug) console.log(args); + // If the command collection doesn't contain the given command, stop here. if (!client.commands.has(command)) return; try { + // Attempt to execute the command client.commands.get(command).execute(message, args); } catch (error) { + // Log errors and let the user know something went wrong. console.error(error); message.channel.send('There was an error trying to execute that command.'); - message.guild.owner } } - const query = message.content.slice(0, -4); - switch (extension) { - case '.gif': - if (debug) console.log(query); + // If there is a file extension + if (file[1] != undefined) { + const query = message.content.slice(0, -4); + switch (file[1]) { + case 'gif': + if (debug) console.log(query); - if (!client.gifs.has(query)) { - giphy.search(query, (err, res) => { - if (res.data[0] != undefined) { - message.channel.send(res.data[0].embed_url).then().catch(console.error); - } else { - message.channel.send('I was unable to find a gif of ' + query); - } - if (err) console.error(err); - }); - } else { - message.channel.send(client.gifs.get(query).embed_url); - } - break; - case '.pasta': - const pastaName = args[0].splice(args[0].search(/\.(?:.(?!\\))+$/gim)) - if (debug) console.log(query); + if (!client.gifs.has(file[0])) { + giphy.search(query, (err, res) => { + if (res.data[0] != undefined) { + message.channel.send(res.data[0].embed_url).then().catch(console.error); + } else { + message.channel.send('I was unable to find a gif of ' + query); + } + if (err) console.error(err); + }); + } else { + message.channel.send(client.gifs.get(query).embed_url); + } + break; + case 'pasta': + // const pastaName = args[0].splice(args[0].search(/\.(?:.(?!\\))+$/gim)) + if (debug) console.log(file[0]); - if (!client.pastas.has(query)) { - message.reply('Sorry I couldn\'t find that gif.'); - } else { - message.channel.send(client.pastas.get(query).content); + if (!client.pastas.has(file[0])) { + message.reply('Sorry I couldn\'t find that gif.'); + } else { + message.channel.send(client.pastas.get(file[0]).content); + } + break; + default: + break; } - break; - default: - break; } + + }); \ No newline at end of file From a11666bc4db4c5534cbbd1fd35a8dd42e4297978 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 19:58:46 -0400 Subject: [PATCH 09/18] 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; }, From d8eff85d5840910cbfe19eb93c64c513844a2b55 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 21:41:46 -0400 Subject: [PATCH 10/18] Add readme --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f58b35 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# NodBot +A simple Discord bot created by @voidf1sh#0420 for retreiving gifs, saving copypastas, and more coming soon. + +## Features +Dynamic Help Message +Ability to save favorite gifs and copypastas + +## Usage +Search for any gif with `search query here.gif` +Save a favorite gif with `/save-gif ` +Recall a saved gif with `gif_name.gif` + +Save a favorite copypasta with `/save-pasta ` +Recall a saved copypasta with `pasta_name.pasta` + +## To Do +Clean up text input for copypastas, line breaks and apostrophes break the bot. +Add ability to reload commands, gifs, pastas, etc without rebooting the bot manually. \ No newline at end of file From 05b16f3f6d2b8ec159f128f57fb1803d6f347a2f Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 21:42:14 -0400 Subject: [PATCH 11/18] Adding log channel and kill command --- commands/kill.js | 24 ++++++++++++++++++++++++ config.json | 5 ++++- index.js | 11 +++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 commands/kill.js diff --git a/commands/kill.js b/commands/kill.js new file mode 100644 index 0000000..c124080 --- /dev/null +++ b/commands/kill.js @@ -0,0 +1,24 @@ +const ownerID = process.env.ownerID; + +module.exports = { + name: 'kill', + description: 'Kills the bot OWNER ONLY', + execute(message, args) { + if (message.author.id == ownerID) { + message.channel.send('Shutting down the bot...') + .then(() => { + message.client.destroy(); + process.exit(); + }); + } else { + message.reply('Sorry, only the owner can do that.'); + message.client.users.fetch(ownerID) + .then(user => { + user.send(message.author.username + ' attempted to shutdown the bot.') + .then() + .catch(err => console.error(err)); + }) + .catch(err => console.error(err)); + } + } +} \ No newline at end of file diff --git a/config.json b/config.json index 7b3bac1..dc0cec2 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,7 @@ { "prefix": "/", - "serverID": "760701839427108874" + "serverID": "760701839427108874", + "logChannel": "858449941911437353", + "bootMessage": "NodBot v2 Starting Up", + "shutdownMessage": "NodBot v2 Shutting Down" } \ No newline at end of file diff --git a/index.js b/index.js index 03f1ebc..2075af9 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ const client = new Discord.Client(); const debug = true; // const config = require('./config.json'); -const { prefix } = require('./config.json'); +const { prefix, logChannel, bootMessage, shutdownMessage } = require('./config.json'); // const owner = process.env.ownerID; const giphy = require('giphy-api')(process.env.giphyAPIKey); @@ -20,6 +20,13 @@ client.once('ready', () => { functions.getCommandFiles(client); functions.getGifFiles(client); functions.getPastaFiles(client); + client.channels.fetch(logChannel) + .then(channel => { + channel.send(bootMessage) + .then() + .catch(err => console.error(err)); + }) + .catch(err => console.error(err)); }); client.login(process.env.TOKEN); @@ -77,7 +84,7 @@ client.on('message', message => { if (!client.pastas.has(file[0])) { message.reply('Sorry I couldn\'t find that gif.'); } else { - message.channel.send(client.pastas.get(file[0]).content); + message.channel.send(client.pastas.get(file[0]).content, { split: { char: ' ' } }); } break; default: From 48188db0b09f66eed2455a2da7c871b15fa70afa Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 21:42:22 -0400 Subject: [PATCH 12/18] misc --- commands/template | 6 +++--- commands/test-textconv.js | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 commands/test-textconv.js diff --git a/commands/template b/commands/template index e87841d..527c41e 100644 --- a/commands/template +++ b/commands/template @@ -1,7 +1,7 @@ module.exports = { - name: "", - description: "", + name: '', + description: '', execute(message, args) { - message.channel.send(""); + message.channel.send(''); } } \ No newline at end of file diff --git a/commands/test-textconv.js b/commands/test-textconv.js new file mode 100644 index 0000000..9d1f1b3 --- /dev/null +++ b/commands/test-textconv.js @@ -0,0 +1,12 @@ +module.exports = { + name: "test-textconv", + description: "Give the bot some text to convert and send back.", + execute(message, args) { + console.log(args); + const textPre = args.join(' '); + const textPost1 = textPre.replace(/\n/,'\n'); + const textPost2 = textPost1.replace(/\'/,'\''); + console.log(textPost1); + console.log(textPost2); + } +} \ No newline at end of file From 60f2ebbc2ad2668f819997cbc4f3f098808d55f6 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 28 Jun 2021 22:38:03 -0400 Subject: [PATCH 13/18] Adding requester in response --- config.json | 2 +- index.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config.json b/config.json index dc0cec2..4bcfb5d 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "prefix": "/", "serverID": "760701839427108874", - "logChannel": "858449941911437353", + "logChannel": "859249300894908447", "bootMessage": "NodBot v2 Starting Up", "shutdownMessage": "NodBot v2 Shutting Down" } \ No newline at end of file diff --git a/index.js b/index.js index 2075af9..2ccc98b 100644 --- a/index.js +++ b/index.js @@ -67,14 +67,14 @@ client.on('message', message => { if (!client.gifs.has(file[0])) { giphy.search(query, (err, res) => { if (res.data[0] != undefined) { - message.channel.send(res.data[0].embed_url).then().catch(console.error); + message.channel.send(query + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error); } else { message.channel.send('I was unable to find a gif of ' + query); } if (err) console.error(err); }); } else { - message.channel.send(client.gifs.get(query).embed_url); + message.channel.send(query + ' requested by ' + message.author.username + '\n' + client.gifs.get(query).embed_url); } break; case 'pasta': @@ -92,5 +92,8 @@ client.on('message', message => { } } - + // Try to delete the requester's message + if (message.deletable) { + message.delete().then().catch(err => console.error(err)); + } }); \ No newline at end of file From 3bdfbf0e443ab25224d47a70fc4d2ce9a90b540e Mon Sep 17 00:00:00 2001 From: = Date: Wed, 30 Jun 2021 18:59:24 -0400 Subject: [PATCH 14/18] Removing all /commands --- commands/gif.js | 20 ++++++++++ commands/pasta.js | 15 ++++++++ commands/spongebob.js | 19 ++++++++++ functions.js | 34 +++++++++++------ index.js | 85 +++++++++++-------------------------------- 5 files changed, 98 insertions(+), 75 deletions(-) create mode 100644 commands/gif.js create mode 100644 commands/pasta.js create mode 100644 commands/spongebob.js diff --git a/commands/gif.js b/commands/gif.js new file mode 100644 index 0000000..000b231 --- /dev/null +++ b/commands/gif.js @@ -0,0 +1,20 @@ +const giphy = require('giphy-api')(process.env.giphyAPIKey); +module.exports = { + name: 'gif', + description: 'Send a GIF', + execute(message, file) { + const client = message.client; + if (!client.gifs.has(file.name)) { + giphy.search(file.name, (err, res) => { + if (res.data[0] != undefined) { + message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error); + } else { + message.channel.send('I was unable to find a gif of ' + file.name); + } + if (err) console.error(err); + }); + } else { + message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + client.gifs.get(file.name).embed_url); + } + } +} \ No newline at end of file diff --git a/commands/pasta.js b/commands/pasta.js new file mode 100644 index 0000000..002bde7 --- /dev/null +++ b/commands/pasta.js @@ -0,0 +1,15 @@ +module.exports = { + name: 'pasta', + description: 'Send a copypasta.', + execute(message, file) { + const client = message.client; + const replyHeader = `\'${file.name}\' requested by: ${message.author.username}\n`; + let replyBody = ''; + if (!client.pastas.has(file.name)) { + replyBody = 'Sorry I couldn\'t find that pasta.'; + } else { + replyBody = client.pastas.get(file.name).content; + } + message.channel.send(replyHeader + replyBody); + } +} \ No newline at end of file diff --git a/commands/spongebob.js b/commands/spongebob.js new file mode 100644 index 0000000..9fc64da --- /dev/null +++ b/commands/spongebob.js @@ -0,0 +1,19 @@ +module.exports = { + name: 'spongebob', + description: 'SpOnGeBoB-iFy AnYtHiNg AuToMaTiCaLly', + execute(message, file) { + const replyHeader = `Requested by: ${message.author.username}\n`; + let flipper = 0; + let newText = ''; + for (const letter of file.name) { + if (flipper == 0) { + newText = newText + letter.toUpperCase(); + flipper = 1; + } else { + newText = newText + letter; + flipper = 0; + } + } + message.channel.send(replyHeader + newText); + } +} \ No newline at end of file diff --git a/functions.js b/functions.js index f85eb75..fda5162 100644 --- a/functions.js +++ b/functions.js @@ -30,20 +30,30 @@ module.exports = { } if (debug) console.log(client.pastas); }, - getExtension(args) { - const finalWord = args[args.length - 1]; - const file = finalWord.split('.'); + getFileInfo(content) { + const finalPeriod = content.search(/\.(?:.(?!\\))+$/gim); + if (finalPeriod < 0) return false; + const extension = content.slice(finalPeriod).replace('.','').toLowerCase(); + const filename = content.slice(0,finalPeriod).toLowerCase(); + const file = { + 'name': filename, + 'extension': extension + }; + console.log(finalPeriod, file); return file; }, - extCheck(content) { - const lastFour = content.slice(-4); - switch (lastFour) { - case '.gif': - return 'gif'; - case '.jpg': - return 'jpg'; - case '.pst': - return 'pst'; + extIsValid(extension) { + switch (extension) { + case 'gif': + return true; + case 'jpg': + return false; + case 'pasta': + return true; + case 'admin': + return true; + case 'spongebob': + return true; default: return false; } diff --git a/index.js b/index.js index 2ccc98b..095c6ab 100644 --- a/index.js +++ b/index.js @@ -20,76 +20,35 @@ client.once('ready', () => { functions.getCommandFiles(client); functions.getGifFiles(client); functions.getPastaFiles(client); - client.channels.fetch(logChannel) - .then(channel => { - channel.send(bootMessage) - .then() - .catch(err => console.error(err)); - }) - .catch(err => console.error(err)); + // client.channels.fetch(logChannel) + // .then(channel => { + // channel.send(bootMessage) + // .then() + // .catch(err => console.error(err)); + // }) + // .catch(err => console.error(err)); }); client.login(process.env.TOKEN); client.on('message', message => { - const args = message.content.trim().split(/ +/); - // TODO this will surely break something when trying to use non-filename commands - const file = functions.getExtension(args); - // If the message is from a bot, or doesn't have the prefix or a file extension, stop here. - if ((!message.content.startsWith(prefix) && file[1] == undefined) || message.author.bot) return; + // Get the filename and extension as an array + // TODO Rename this function to something more appropriate + const file = functions.getFileInfo(message.content); + if (!file) return; + // If the message is from a bot, or doesn't have a valid file extension, stop here. + if (functions.extIsValid(file.extension) == false || message.author.bot) return; - // If the message starts with the prefix, - if (message.content.startsWith(prefix)) { - // Extract the command - const command = args.shift().toLowerCase().slice(prefix.length); + // If the command collection doesn't contain the given command, stop here. + if (!client.commands.has(file.extension)) return; - if (debug) console.log(args); - // If the command collection doesn't contain the given command, stop here. - if (!client.commands.has(command)) return; - - try { - // Attempt to execute the command - client.commands.get(command).execute(message, args); - } catch (error) { - // Log errors and let the user know something went wrong. - console.error(error); - message.channel.send('There was an error trying to execute that command.'); - } - } - - // If there is a file extension - if (file[1] != undefined) { - const query = message.content.slice(0, -4); - switch (file[1]) { - case 'gif': - if (debug) console.log(query); - - if (!client.gifs.has(file[0])) { - giphy.search(query, (err, res) => { - if (res.data[0] != undefined) { - message.channel.send(query + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error); - } else { - message.channel.send('I was unable to find a gif of ' + query); - } - if (err) console.error(err); - }); - } else { - message.channel.send(query + ' requested by ' + message.author.username + '\n' + client.gifs.get(query).embed_url); - } - break; - case 'pasta': - // const pastaName = args[0].splice(args[0].search(/\.(?:.(?!\\))+$/gim)) - if (debug) console.log(file[0]); - - if (!client.pastas.has(file[0])) { - message.reply('Sorry I couldn\'t find that gif.'); - } else { - message.channel.send(client.pastas.get(file[0]).content, { split: { char: ' ' } }); - } - break; - default: - break; - } + try { + // Attempt to execute the command + client.commands.get(file.extension).execute(message, file); + } catch (error) { + // Log errors and let the user know something went wrong. + console.error(error); + message.channel.send('There was an error trying to execute that command.'); } // Try to delete the requester's message From e810a78facf5aa0e0609456731909f814d3b07d8 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 1 Jul 2021 18:12:21 -0400 Subject: [PATCH 15/18] More command conversions --- commands/get-ext.js | 10 - commands/help.js | 15 +- commands/request.js | 4 +- commands/save-gif.js | 20 - commands/save-pasta.js | 17 - commands/savegif.js | 19 + commands/savepasta.js | 21 ++ config.json | 11 +- functions.js | 20 +- index.js | 1 - package-lock.json | 836 +++++++++++++++++++++++++++++++++++++++-- package.json | 3 +- 12 files changed, 872 insertions(+), 105 deletions(-) delete mode 100644 commands/get-ext.js delete mode 100644 commands/save-gif.js delete mode 100644 commands/save-pasta.js create mode 100644 commands/savegif.js create mode 100644 commands/savepasta.js diff --git a/commands/get-ext.js b/commands/get-ext.js deleted file mode 100644 index 34db506..0000000 --- a/commands/get-ext.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - name: "get-ext", - description: "Test function to capture the extension from the content of a message.", - execute(message, args) { - const finalWord = args.pop(); - const file = finalWord.split('.'); - console.log(file); - message.reply('The extension is: ' + file[1] + '\nThe filename is: ' + file[0]); - } -} \ No newline at end of file diff --git a/commands/help.js b/commands/help.js index 26be304..130f5cb 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,16 +1,14 @@ -const { prefix } = require('../config.json'); - module.exports = { name: 'help', description: 'Shows the help page.', - execute(message, args) { + execute(message, file) { const data = []; const { commands } = message.client; - if (!args.length) { + if (!file.name) { data.push('Here\'s a list of all my commands:'); data.push(commands.map(command => command.name).join(', ')); - data.push(`\nYou can send \`${prefix}help [command name]\` to get info on a specific command!`); + data.push('\nYou can send `[command name].help` to get info on a specific command!'); return message.author.send(data, { split: true }) .then(() => { @@ -19,15 +17,14 @@ module.exports = { }) .catch(error => { console.error(`Could not send help DM to ${message.author.tag}.\n`, error); - message.reply('it seems like I can\'t DM you! Do you have DMs disabled?'); + message.reply('It seems like I can\'t DM you! Do you have DMs disabled?'); }); } - const name = args[0].toLowerCase(); - const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name)); + const command = commands.get(file.name) || commands.find(c => c.aliases && c.aliases.includes(file.name)); if (!command) { - return message.reply('that\'s not a valid command!'); + return message.reply('That\'s not a valid command!'); } data.push(`**Name:** ${command.name}`); diff --git a/commands/request.js b/commands/request.js index 03696cb..0ac7825 100644 --- a/commands/request.js +++ b/commands/request.js @@ -1,8 +1,8 @@ module.exports = { name: 'request', description: 'Submit a request to the bot developer.', - execute(message, args) { - const request = args.join(' '); + execute(message, file) { + const request = file.name; message.channel.send('Your request has been submitted:\n```\n' + request + '\n```'); message.client.users.fetch(process.env.ownerID).then(user => {user.send('New request or feedback:\n```\n' + request + '\n```');}).catch(error => { console.error(error);} ); } diff --git a/commands/save-gif.js b/commands/save-gif.js deleted file mode 100644 index 3da3aa9..0000000 --- a/commands/save-gif.js +++ /dev/null @@ -1,20 +0,0 @@ -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]}.js`, `module.exports = {\n\tname: '${args[0]}',\n\tembed_url: '${args[1]}'\n}`, function(err) { - if (err) throw err; - console.log('Saved file!'); - const gif = require(`../gifs/${args[0]}.js`); - message.client.gifs.set(gif.name, gif); - }); - - message.reply('GIF saved as: ' + args[0] + '.gif!'); - } -} \ No newline at end of file diff --git a/commands/save-pasta.js b/commands/save-pasta.js deleted file mode 100644 index 1dfdaf8..0000000 --- a/commands/save-pasta.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - name: 'save-pasta', - description: 'Adds a given copypasta to the hardcoded list.', - execute(message, args) { - const fs = require('fs'); - const filename = args.shift(); - const pastaText = args.join(' '); - 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(`../pastas/${filename}.js`); - message.client.pastas.set(pasta.name, pasta); - }); - - message.reply('GIF saved as: ' + filename + '.pasta!'); - } -} \ No newline at end of file diff --git a/commands/savegif.js b/commands/savegif.js new file mode 100644 index 0000000..339ba28 --- /dev/null +++ b/commands/savegif.js @@ -0,0 +1,19 @@ +module.exports = { + name: 'savegif', + description: 'Adds a given gif to the hardcoded list.', + execute(message, file) { + const tempArray = file.name.split(' '); + const embedURL = tempArray.shift(); + const gifName = tempArray.join(' '); + + const fs = require('fs'); + fs.appendFile(`./gifs/${gifName}.js`, `module.exports = {\n\tname: '${gifName}',\n\tembed_url: '${embedURL}'\n}`, function(err) { + if (err) throw err; + console.log('Saved file!'); + const gif = require(`../gifs/${gifName}.js`); + message.client.gifs.set(gif.name, gif); + }); + + message.reply('GIF saved as: ' + gifName + '.gif!'); + } +} \ No newline at end of file diff --git a/commands/savepasta.js b/commands/savepasta.js new file mode 100644 index 0000000..e5ced4f --- /dev/null +++ b/commands/savepasta.js @@ -0,0 +1,21 @@ +const functions = require('../functions.js'); + +module.exports = { + name: 'savepasta', + description: 'Adds a given copypasta to the hardcoded list.', + execute(message, file) { + const fs = require('fs'); + const pastaTextArray = message.content.split(' '); + const pastaFile = functions.getFileInfo(pastaTextArray.pop()); + const pastaText = pastaTextArray.join(' '); + const pastaTextEscaped = pastaText.replace(/'/g, '\\\'').replace(/\n/g, '\\n'); + fs.appendFile(`./pastas/${pastaFile.name}.js`, `module.exports = {\n\tname: '${pastaFile.name}',\n\tcontent: '${pastaTextEscaped}'\n}`, function(err) { + if (err) throw err; + console.log('Saved file!'); + const pasta = require(`../pastas/${pastaFile.name}.js`); + message.client.pastas.set(pasta.name, pasta); + }); + + message.reply('GIF saved as: ' + pastaFile.name + '.pasta!'); + } +} \ No newline at end of file diff --git a/config.json b/config.json index 4bcfb5d..0c59dce 100644 --- a/config.json +++ b/config.json @@ -3,5 +3,14 @@ "serverID": "760701839427108874", "logChannel": "859249300894908447", "bootMessage": "NodBot v2 Starting Up", - "shutdownMessage": "NodBot v2 Shutting Down" + "shutdownMessage": "NodBot v2 Shutting Down", + "validExtensions": [ + "gif", + "pasta", + "help", + "spongebob", + "savepasta", + "request", + "savegif" + ] } \ No newline at end of file diff --git a/functions.js b/functions.js index fda5162..1fd5a93 100644 --- a/functions.js +++ b/functions.js @@ -31,7 +31,8 @@ module.exports = { if (debug) console.log(client.pastas); }, getFileInfo(content) { - const finalPeriod = content.search(/\.(?:.(?!\\))+$/gim); + // const finalPeriod = content.search(/\.(?:.(?!\\))+$/gim); + const finalPeriod = content.lastIndexOf('.'); if (finalPeriod < 0) return false; const extension = content.slice(finalPeriod).replace('.','').toLowerCase(); const filename = content.slice(0,finalPeriod).toLowerCase(); @@ -39,23 +40,10 @@ module.exports = { 'name': filename, 'extension': extension }; - console.log(finalPeriod, file); return file; }, extIsValid(extension) { - switch (extension) { - case 'gif': - return true; - case 'jpg': - return false; - case 'pasta': - return true; - case 'admin': - return true; - case 'spongebob': - return true; - default: - return false; - } + const extensions = require('./config.json').validExtensions; + return extensions.includes(extension); } } \ No newline at end of file diff --git a/index.js b/index.js index 095c6ab..2309165 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,6 @@ client.login(process.env.TOKEN); client.on('message', message => { // Get the filename and extension as an array - // TODO Rename this function to something more appropriate const file = functions.getFileInfo(message.content); if (!file) return; // If the message is from a bot, or doesn't have a valid file extension, stop here. diff --git a/package-lock.json b/package-lock.json index 6922b89..4b6d1ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,6 +81,24 @@ "strip-json-comments": "^3.1.1" } }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, "abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -113,6 +131,49 @@ "uri-js": "^4.2.2" } }, + "ansi-align": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", + "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", + "requires": { + "string-width": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -122,8 +183,7 @@ "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" }, "ansi-styles": { "version": "3.2.1", @@ -134,6 +194,15 @@ "color-convert": "^1.9.0" } }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -157,25 +226,135 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" + }, + "boxen": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", + "integrity": "sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==", + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^5.3.1", + "chalk": "^3.0.0", + "cli-boxes": "^2.2.0", + "string-width": "^4.1.0", + "term-size": "^2.1.0", + "type-fest": "^0.8.1", + "widest-line": "^3.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==" + } + } }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + } + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, "chalk": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", @@ -227,6 +406,39 @@ } } }, + "chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" + }, + "cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==" + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "requires": { + "mimic-response": "^1.0.0" + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -253,8 +465,20 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "requires": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } }, "cross-spawn": { "version": "7.0.3", @@ -267,6 +491,11 @@ "which": "^2.0.1" } }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==" + }, "debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", @@ -276,12 +505,30 @@ "ms": "2.1.2" } }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -311,16 +558,36 @@ "esutils": "^2.0.2" } }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "requires": { + "is-obj": "^2.0.0" + } + }, "dotenv": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" + }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } }, "enquirer": { "version": "2.3.6", @@ -331,6 +598,11 @@ "ansi-colors": "^4.1.1" } }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==" + }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -520,6 +792,14 @@ "flat-cache": "^3.0.4" } }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, "flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -542,12 +822,26 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, "giphy-api": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/giphy-api/-/giphy-api-2.0.1.tgz", @@ -571,11 +865,18 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "requires": { "is-glob": "^4.0.1" } }, + "global-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-2.1.0.tgz", + "integrity": "sha512-MG6kdOUh/xBnyo9cJFeIKkLEc1AyFq42QTU4XiX51i2NEdxLxLWXIjEjmqKeSuKR7pAZjTqUVoT2b2huxVLgYQ==", + "requires": { + "ini": "1.3.7" + } + }, "globals": { "version": "13.9.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", @@ -585,11 +886,43 @@ "type-fest": "^0.20.2" } }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==" + }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==" }, "ignore": { "version": "4.0.6", @@ -597,6 +930,11 @@ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=" + }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -607,11 +945,15 @@ "resolve-from": "^4.0.0" } }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=" + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" }, "inflight": { "version": "1.0.6", @@ -629,27 +971,84 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "ini": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz", + "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==" + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "requires": { + "ci-info": "^2.0.0" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, "requires": { "is-extglob": "^2.1.1" } }, + "is-installed-globally": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.3.2.tgz", + "integrity": "sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==", + "requires": { + "global-dirs": "^2.0.1", + "is-path-inside": "^3.0.1" + } + }, + "is-npm": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-4.0.0.tgz", + "integrity": "sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==" + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -672,6 +1071,11 @@ "esprima": "^4.0.0" } }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -684,6 +1088,22 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "requires": { + "json-buffer": "3.0.0" + } + }, + "latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "requires": { + "package-json": "^6.3.0" + } + }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -712,6 +1132,11 @@ "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", "dev": true }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -721,6 +1146,21 @@ "yallist": "^4.0.0" } }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, "mime-db": { "version": "1.48.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", @@ -734,20 +1174,28 @@ "mime-db": "1.48.0" } }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "natural-compare": { "version": "1.4.0", @@ -760,11 +1208,60 @@ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, + "nodemon": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.9.tgz", + "integrity": "sha512-6O4k7C8f2HQArGpaPBOqGGddjzDLQAqCYmq3tKMeNIbz7Is/hOphMHy2dcY10sSq5wl3cqyn9Iz+Ep2j51JOLg==", + "requires": { + "chokidar": "^3.2.2", + "debug": "^3.2.6", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.7", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.3", + "update-notifier": "^4.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -783,6 +1280,29 @@ "word-wrap": "^1.2.3" } }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" + }, + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "requires": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -804,12 +1324,22 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==" + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" + }, "prism-media": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.1.tgz", @@ -821,18 +1351,82 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "requires": { + "escape-goat": "^2.0.0" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + } + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "requires": { + "picomatch": "^2.2.1" + } + }, "regexpp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, + "registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "requires": { + "rc": "^1.2.8" + } + }, "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -845,6 +1439,14 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "requires": { + "lowercase-keys": "^1.0.0" + } + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -863,6 +1465,21 @@ "lru-cache": "^6.0.0" } }, + "semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -883,6 +1500,11 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, "slice-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", @@ -930,7 +1552,6 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -941,7 +1562,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, "requires": { "ansi-regex": "^5.0.0" } @@ -956,7 +1576,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -995,12 +1614,38 @@ } } }, + "term-size": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", + "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==" + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "requires": { + "nopt": "~1.0.10" + } + }, "tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", @@ -1021,6 +1666,110 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "undefsafe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.3.tgz", + "integrity": "sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==", + "requires": { + "debug": "^2.2.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "update-notifier": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", + "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==", + "requires": { + "boxen": "^4.2.0", + "chalk": "^3.0.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.3.1", + "is-npm": "^4.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.0.0", + "pupa": "^2.0.1", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -1030,6 +1779,14 @@ "punycode": "^2.1.0" } }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "requires": { + "prepend-http": "^2.0.0" + } + }, "v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -1045,6 +1802,14 @@ "isexe": "^2.0.0" } }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "requires": { + "string-width": "^4.0.0" + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -1054,14 +1819,29 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } }, "ws": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz", "integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==" }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==" + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", diff --git a/package.json b/package.json index 3f33b23..12414a9 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dependencies": { "discord.js": "^12.5.3", "dotenv": "^10.0.0", - "giphy-api": "^2.0.1" + "giphy-api": "^2.0.1", + "nodemon": "^2.0.9" }, "devDependencies": { "eslint": "^7.29.0" From 2c6d424baa0b0ce0423d92257ec5f32e3ff2aae0 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 6 Jul 2021 17:37:04 -0400 Subject: [PATCH 16/18] updating valid commands --- config.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 0c59dce..a9419c4 100644 --- a/config.json +++ b/config.json @@ -11,6 +11,11 @@ "spongebob", "savepasta", "request", - "savegif" - ] + "savegif", + "truth", + "joint" + ], + "emoji": { + "joint": "<:joint:862082955902976000>" + } } \ No newline at end of file From 5dc2a1ab533f85f4608acaf6e90e4173e5fa4212 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 6 Jul 2021 17:37:29 -0400 Subject: [PATCH 17/18] sanitizing inputs and creating embeds --- README.md | 3 +++ commands/gif.js | 18 ++++++++++++++++-- commands/help.js | 2 +- commands/joint.js | 9 +++++++++ commands/log-message.js | 7 ------- commands/ping.js | 7 ------- commands/reload-gifs.js | 9 --------- commands/request.js | 1 + commands/savegif.js | 1 + commands/savepasta.js | 3 ++- commands/spongebob.js | 1 + commands/test-textconv.js | 12 ------------ functions.js | 11 +++++++++++ 13 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 commands/joint.js delete mode 100644 commands/log-message.js delete mode 100644 commands/ping.js delete mode 100644 commands/reload-gifs.js delete mode 100644 commands/test-textconv.js diff --git a/README.md b/README.md index 6f58b35..fd6d3a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # NodBot A simple Discord bot created by @voidf1sh#0420 for retreiving gifs, saving copypastas, and more coming soon. +## Dependancies +NodBot depends on `fs`, `discord.js`, `dotenv`, and `giphy-api`. + ## Features Dynamic Help Message Ability to save favorite gifs and copypastas diff --git a/commands/gif.js b/commands/gif.js index 000b231..9692c22 100644 --- a/commands/gif.js +++ b/commands/gif.js @@ -1,3 +1,5 @@ +const functions = require('../functions'); + const giphy = require('giphy-api')(process.env.giphyAPIKey); module.exports = { name: 'gif', @@ -7,14 +9,26 @@ module.exports = { if (!client.gifs.has(file.name)) { giphy.search(file.name, (err, res) => { if (res.data[0] != undefined) { - message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error); + // message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error); + const gifInfo = { + 'name': file.name, + 'embed_url': res.data[0].images.original.url, + 'requestor': '@' + message.author.username + '#' + message.author.discriminator, + }; + message.channel.send(functions.createGifEmbed(gifInfo)); } else { message.channel.send('I was unable to find a gif of ' + file.name); } if (err) console.error(err); }); } else { - message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + client.gifs.get(file.name).embed_url); + // message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + client.gifs.get(file.name).embed_url); + const gifInfo = { + 'name': file.name, + 'embed_url': file.embed_url, + 'requestor': message.author.username + '#' + message.author.discriminator, + }; + message.channel.send(functions.createGifEmbed(gifInfo)); } } } \ No newline at end of file diff --git a/commands/help.js b/commands/help.js index 130f5cb..c02ad47 100644 --- a/commands/help.js +++ b/commands/help.js @@ -31,7 +31,7 @@ module.exports = { if (command.aliases) data.push(`**Aliases:** ${command.aliases.join(', ')}`); if (command.description) data.push(`**Description:** ${command.description}`); - if (command.usage) data.push(`**Usage:** ${prefix}${command.name} ${command.usage}`); + if (command.usage) data.push(`**Usage:** \`${command.usage}.${command.name}\``); data.push(`**Cooldown:** ${command.cooldown || 3} second(s)`); diff --git a/commands/joint.js b/commands/joint.js new file mode 100644 index 0000000..84651eb --- /dev/null +++ b/commands/joint.js @@ -0,0 +1,9 @@ +const { emoji } = require('../config.json'); + +module.exports = { + name: 'joint', + description: 'Pass the joint!', + execute(message, args) { + message.channel.send('It\'s dangerous to go alone... take this: ' + emoji.joint); + } +} \ No newline at end of file diff --git a/commands/log-message.js b/commands/log-message.js deleted file mode 100644 index fbbb02a..0000000 --- a/commands/log-message.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - name: "log-message", - description: "Logs the message to console for debugging purposes.", - execute(message, args) { - console.log(message); - } -} \ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js deleted file mode 100644 index eb270b5..0000000 --- a/commands/ping.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - name: 'ping', - description: 'Ping!', - execute(message, args) { - message.channel.send('Pong.'); - } -} \ No newline at end of file diff --git a/commands/reload-gifs.js b/commands/reload-gifs.js deleted file mode 100644 index 2cf85c3..0000000 --- a/commands/reload-gifs.js +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable quotes */ -module.exports = { - name: "reload-gifs", - description: "Refresh the hardcoded gif library.", - execute(message, args) { - const functions = require('../functions.js'); - functions.getGifFiles(message.client); - } -} \ No newline at end of file diff --git a/commands/request.js b/commands/request.js index 0ac7825..11626d8 100644 --- a/commands/request.js +++ b/commands/request.js @@ -1,6 +1,7 @@ module.exports = { name: 'request', description: 'Submit a request to the bot developer.', + usage: '', execute(message, file) { const request = file.name; message.channel.send('Your request has been submitted:\n```\n' + request + '\n```'); diff --git a/commands/savegif.js b/commands/savegif.js index 339ba28..9e49863 100644 --- a/commands/savegif.js +++ b/commands/savegif.js @@ -1,6 +1,7 @@ module.exports = { name: 'savegif', description: 'Adds a given gif to the hardcoded list.', + usage: ' ', execute(message, file) { const tempArray = file.name.split(' '); const embedURL = tempArray.shift(); diff --git a/commands/savepasta.js b/commands/savepasta.js index e5ced4f..3a2977b 100644 --- a/commands/savepasta.js +++ b/commands/savepasta.js @@ -3,12 +3,13 @@ const functions = require('../functions.js'); module.exports = { name: 'savepasta', description: 'Adds a given copypasta to the hardcoded list.', + usage: ' ', execute(message, file) { const fs = require('fs'); const pastaTextArray = message.content.split(' '); const pastaFile = functions.getFileInfo(pastaTextArray.pop()); const pastaText = pastaTextArray.join(' '); - const pastaTextEscaped = pastaText.replace(/'/g, '\\\'').replace(/\n/g, '\\n'); + const pastaTextEscaped = functions.cleanInput(pastaText); fs.appendFile(`./pastas/${pastaFile.name}.js`, `module.exports = {\n\tname: '${pastaFile.name}',\n\tcontent: '${pastaTextEscaped}'\n}`, function(err) { if (err) throw err; console.log('Saved file!'); diff --git a/commands/spongebob.js b/commands/spongebob.js index 9fc64da..20bd9f9 100644 --- a/commands/spongebob.js +++ b/commands/spongebob.js @@ -1,6 +1,7 @@ module.exports = { name: 'spongebob', description: 'SpOnGeBoB-iFy AnYtHiNg AuToMaTiCaLly', + usage: ' Date: Tue, 6 Jul 2021 17:42:19 -0400 Subject: [PATCH 18/18] removing janky debugging --- functions.js | 4 ---- index.js | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/functions.js b/functions.js index 67237be..09ae5f0 100644 --- a/functions.js +++ b/functions.js @@ -3,7 +3,6 @@ const fs = require('fs'); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); const gifFiles = fs.readdirSync('./gifs').filter(file => file.endsWith('.js')); const pastaFiles = fs.readdirSync('./pastas').filter(file => file.endsWith('.js')); -const debug = true; module.exports = { getCommandFiles(client) { @@ -12,7 +11,6 @@ module.exports = { const command = require(`./commands/${file}`); client.commands.set(command.name, command); } - if (debug) console.log(client.commands); }, getGifFiles(client) { client.gifs = new Discord.Collection(); @@ -20,7 +18,6 @@ module.exports = { const gif = require(`./gifs/${file}`); client.gifs.set(gif.name, gif); } - if (debug) console.log(client.gifs); }, getPastaFiles(client) { client.pastas = new Discord.Collection(); @@ -28,7 +25,6 @@ module.exports = { const pasta = require(`./pastas/${file}`); client.pastas.set(pasta.name, pasta); } - if (debug) console.log(client.pastas); }, getFileInfo(content) { // const finalPeriod = content.search(/\.(?:.(?!\\))+$/gim); diff --git a/index.js b/index.js index 2309165..a86bae3 100644 --- a/index.js +++ b/index.js @@ -5,9 +5,8 @@ dotenv.config(); const Discord = require('discord.js'); const client = new Discord.Client(); -const debug = true; // const config = require('./config.json'); -const { prefix, logChannel, bootMessage, shutdownMessage } = require('./config.json'); +// const { prefix, logChannel, bootMessage, shutdownMessage } = require('./config.json'); // const owner = process.env.ownerID; const giphy = require('giphy-api')(process.env.giphyAPIKey);