diff --git a/command/CODM/build.js b/command/CODM/build.js index 8bb76b0..ccf72aa 100644 --- a/command/CODM/build.js +++ b/command/CODM/build.js @@ -655,20 +655,6 @@ module.exports = { }, ], run: async (client, interaction, args) => { - const cwts = args[1]; - const cc = args[2]; - const tag = args[3]; - const data = await axios - .get( - `${process.env.api}/api/v1/codm/build?cwts=${cwts}&cc=${cc}&tag=${tag}`, - { - headers: { - Authorization: process.env.CODM_API_KEY, - }, - } - ) - .then(res => res.data) - .catch(e => null); var all = { "path.exe": "path.exe", dhitman: "dHitman", @@ -681,6 +667,20 @@ module.exports = { ads: "ADS", hipfire: "Hipfire", }; + const cwts = args[1]; + const cc = args[2]; + const tag = args[3]; + const data = await axios + .get( + `${process.env.api}/api/v1/codm/build?cwts=${cwts}&cc=${all[cc]}&tag=${all[tag]}`, + { + headers: { + Authorization: process.env.CODM_API_KEY, + }, + } + ) + .then(res => res.data) + .catch(e => null); if (!data?.cwts) { const embed = new MessageEmbed() diff --git a/command/Fun/dare.js b/command/Fun/dare.js index 611416c..3bf99ae 100644 --- a/command/Fun/dare.js +++ b/command/Fun/dare.js @@ -9,7 +9,7 @@ module.exports = { name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dyamic: true }), }) - .setTitle(dares[Math.round(Math.random() * tnd.dare.length - 1)]) + .setTitle(tnd.dare[Math.round(Math.random() * tnd.dare.length - 1)]) .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, diff --git a/command/Fun/truth.js b/command/Fun/truth.js index b2c9cb9..b3d31ed 100644 --- a/command/Fun/truth.js +++ b/command/Fun/truth.js @@ -9,7 +9,7 @@ module.exports = { name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dyamic: true }), }) - .setTitle(truth[Math.round(Math.random() * tnd.truth.length)]) + .setTitle(tnd.truth[Math.round(Math.random() * tnd.truth.length)]) .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, diff --git a/util/functions/common.js b/util/functions/common.js index 0cf0fdf..515913b 100644 --- a/util/functions/common.js +++ b/util/functions/common.js @@ -321,11 +321,16 @@ function attachmentsIdentifier(inpmsg, gun) { const temp1 = probables[probables.length - 1].filter( x => gun.aments[x].name.Simplify() == inputAttachmentsNames[i].Simplify() ); + // see if the length of the array is the same or not + // Eg: splitAttachmentsDataName[x] = ["stippled", "grip", "tape"] and splitInputAttachmentsName = ["stippled", "grip", "tape"] + // then it it equal const temp2 = probables[probables.length - 1].filter( x => splitAttachmentsDataName[x].length == splitInputAttachmentsName.length ); - /**/ if (temp1.length === 1 && temp2.length !== 1) { + + // if found probable, push it + if (temp1.length === 1 && temp2.length !== 1) { probables.push([temp1]); } else if (temp1.length !== 1 && temp2.length === 1) { probables.push([temp2]); @@ -336,20 +341,22 @@ function attachmentsIdentifier(inpmsg, gun) { ) { probables.push([temp1]); } + console.log(proba); if ( probables[probables.length - 1].length != 1 || probables.length < splitInputAttachmentsName.length ) { + // ask the user if he/she means xxx = which attachment errors.push( - "`" + - curr + `\` + ${curr .map(x => gun.aments[x].name) .reduce((out, x, i) => [out, x].join(i === curr.length - 1 ? "` or `" : "`, `") - ) + - '` by `"' + - inputAttachmentsNames[i] + - '"`' + )} + + \` by \`" + ${inputAttachmentsNames[i]} + "\`` ); } outAttachments.push(gun.aments[probables[probables.length - 1][0]]); @@ -415,7 +422,7 @@ function attachmentsIdentifier(inpmsg, gun) { // console.log(attachmentsIdentifier("ak + 5mw lazer", data.cguns[0].aments)); makeError(); // console.log(attachmentsIdentifier("117 + 40 round mag", data.cguns[0].aments, data.cguns[0].stats)); makeError(); // console.log(attachmentsIdentifier("117 + rtc muzzle brake, rubberized griptape, tac lazer sight, 40 round mag, no stock", data.cguns[1].aments)); makeError(); -console.log(attachmentsIdentifier("47 + dsfasdfaz", data.cguns[0])); +console.log(attachmentsIdentifier("47 + stipplied grip tape", data.cguns[0])); makeError(); function damageHandler( currDmgs,