bug fix and 363/824 44%

This commit is contained in:
night0721 2022-02-04 06:08:59 +08:00
parent 2cac998d50
commit 5813259731
4 changed files with 31 additions and 24 deletions

View file

@ -655,20 +655,6 @@ module.exports = {
}, },
], ],
run: async (client, interaction, args) => { 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 = { var all = {
"path.exe": "path.exe", "path.exe": "path.exe",
dhitman: "dHitman", dhitman: "dHitman",
@ -681,6 +667,20 @@ module.exports = {
ads: "ADS", ads: "ADS",
hipfire: "Hipfire", 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) { if (!data?.cwts) {
const embed = new MessageEmbed() const embed = new MessageEmbed()

View file

@ -9,7 +9,7 @@ module.exports = {
name: interaction.user.tag, name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dyamic: true }), 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) .setColor(client.color)
.setFooter({ .setFooter({
text: `Made by ${client.author}`, text: `Made by ${client.author}`,

View file

@ -9,7 +9,7 @@ module.exports = {
name: interaction.user.tag, name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dyamic: true }), 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) .setColor(client.color)
.setFooter({ .setFooter({
text: `Made by ${client.author}`, text: `Made by ${client.author}`,

View file

@ -321,11 +321,16 @@ function attachmentsIdentifier(inpmsg, gun) {
const temp1 = probables[probables.length - 1].filter( const temp1 = probables[probables.length - 1].filter(
x => gun.aments[x].name.Simplify() == inputAttachmentsNames[i].Simplify() 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( const temp2 = probables[probables.length - 1].filter(
x => x =>
splitAttachmentsDataName[x].length == splitInputAttachmentsName.length 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]); probables.push([temp1]);
} else if (temp1.length !== 1 && temp2.length === 1) { } else if (temp1.length !== 1 && temp2.length === 1) {
probables.push([temp2]); probables.push([temp2]);
@ -336,20 +341,22 @@ function attachmentsIdentifier(inpmsg, gun) {
) { ) {
probables.push([temp1]); probables.push([temp1]);
} }
console.log(proba);
if ( if (
probables[probables.length - 1].length != 1 || probables[probables.length - 1].length != 1 ||
probables.length < splitInputAttachmentsName.length probables.length < splitInputAttachmentsName.length
) { ) {
// ask the user if he/she means xxx = which attachment
errors.push( errors.push(
"`" + `\`
curr ${curr
.map(x => gun.aments[x].name) .map(x => gun.aments[x].name)
.reduce((out, x, i) => .reduce((out, x, i) =>
[out, x].join(i === curr.length - 1 ? "` or `" : "`, `") [out, x].join(i === curr.length - 1 ? "` or `" : "`, `")
) + )} +
'` by `"' + \` by \`"
inputAttachmentsNames[i] + ${inputAttachmentsNames[i]}
'"`' "\``
); );
} }
outAttachments.push(gun.aments[probables[probables.length - 1][0]]); 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("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 + 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("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(); makeError();
function damageHandler( function damageHandler(
currDmgs, currDmgs,