From ad2fd5c1c3feb158c700f8b07b360e83b03d1829 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 7 Jan 2023 13:15:54 -0500 Subject: [PATCH 1/3] Add the ability to use an array of aliases --- functions.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/functions.js b/functions.js index 3f7f227..70aec19 100644 --- a/functions.js +++ b/functions.js @@ -56,10 +56,13 @@ const functions = { setvalidCommands(client) { for (const entry of client.dotCommands.map(command => command)) { config.validCommands.push(entry.name); - if (entry.alias != undefined) { + if (Array.isArray(entry.alias)) { + entry.alias.forEach(element => { + config.validCommands.push(element); + }); + } else if (entry.alias != undefined) { config.validCommands.push(entry.alias); } - } if (isDev) console.log(`Valid Commands Added to Config\n${config.validCommands}`); }, @@ -69,7 +72,11 @@ const functions = { for (const file of dotCommandFiles) { const dotCommand = require(`./dot-commands/${file}`); client.dotCommands.set(dotCommand.name, dotCommand); - if (dotCommand.alias != undefined) { + if (Array.isArray(dotCommand.alias)) { + dotCommand.alias.forEach(element => { + client.dotCommands.set(element, dotCommand); + }); + } else if (dotCommand.alias != undefined) { client.dotCommands.set(dotCommand.alias, dotCommand); } } From c20dbeafaf30fb8859f18be3113fb4c9c0023650 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 7 Jan 2023 13:16:00 -0500 Subject: [PATCH 2/3] Increment Version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 81c41bb..9b73aa0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodbot", - "version": "3.0.3", + "version": "3.0.4", "description": "Nods and Nod Accessories.", "main": "main.js", "dependencies": { From 9f0d22c34f6db8bd56b10de42627164bbae2d80a Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 7 Jan 2023 13:16:05 -0500 Subject: [PATCH 3/3] Add new aliases --- dot-commands/joint.js | 1 + 1 file changed, 1 insertion(+) diff --git a/dot-commands/joint.js b/dot-commands/joint.js index 733dade..2ce3202 100644 --- a/dot-commands/joint.js +++ b/dot-commands/joint.js @@ -5,6 +5,7 @@ module.exports = { name: 'joint', description: 'Send a random weed-themed phrase.', usage: '.joint', + alias: ['bong', 'blunt', 'bowl', 'pipe'], execute(message, commandData) { let joints = []; for (const entry of message.client.joints.map(joint => joint.content)) {