commit 5813259731caf7e7734f4d6ce839680cbbb96b8a
parent 2cac998d50bac938ab0156f544898b8e1ae86e97
Author: night0721 <[email protected]>
Date: Fri, 4 Feb 2022 06:08:59 +0800
bug fix and 363/824 44%
Diffstat:
4 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/command/CODM/build.js b/command/CODM/build.js
@@ -655,12 +655,24 @@ module.exports = {
},
],
run: async (client, interaction, args) => {
+ var all = {
+ "path.exe": "path.exe",
+ dhitman: "dHitman",
+ jokesta: "Jokesta",
+ sod: "Stats On Duty",
+ aggressive: "Aggressive",
+ passive: "Passive",
+ respawn: "Respawn",
+ snd: "Search And Destroy",
+ 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=${cc}&tag=${tag}`,
+ `${process.env.api}/api/v1/codm/build?cwts=${cwts}&cc=${all[cc]}&tag=${all[tag]}`,
{
headers: {
Authorization: process.env.CODM_API_KEY,
@@ -669,18 +681,6 @@ module.exports = {
)
.then(res => res.data)
.catch(e => null);
- var all = {
- "path.exe": "path.exe",
- dhitman: "dHitman",
- jokesta: "Jokesta",
- sod: "Stats On Duty",
- aggressive: "Aggressive",
- passive: "Passive",
- respawn: "Respawn",
- snd: "Search And Destroy",
- ads: "ADS",
- hipfire: "Hipfire",
- };
if (!data?.cwts) {
const embed = new MessageEmbed()
diff --git 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
@@ -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
@@ -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,