Dobry, mam taki problemik z kodem i chyba sam się już zgubiłem kod daje mi tylko że w linijce jest unexpected token else i nw w którym momencie źle mam zamknięcia jeśli była by jakaś miła osóbka i pomogła mi to naprawić będę wdzięczny nadmienię że następnego else if też nie łapie
else if (MSG.toUpperCase().indexOf("!BUYGEMS4TF") >= 0) {
if (botSets) {
let n = MSG.toUpperCase().replace("!BUYGEMS4TF ", ""),
GemsToGive = parseInt(n) * CONFIG.CARDS.GEM4TF;
if (!isNaN(n) && parseInt(n) > 0) {
if (n <= CONFIG.MESSAGES.MAXBUY) {
let t = manager.createOffer(SENDER.getSteamID64());
t.getUserDetails((ERR, ME, THEM) => {
if (ERR) {
console.log("## An error occurred while getting trade holds: " + ERR);
client.chatMessage(SENDER, "[Error] An error occurred while getting your trade holds. Please try again");
} else if (ME.escrowDays == 0 && THEM.escrowDays == 0) {
n = parseInt(n);
let theirKeys = [];
client.chatMessage(SENDER, "You Requested To Buy" + GemsToGive + " with " + n + " TF2 Keys!");
sleep(1500);
client.chatMessage(SENDER, "Processing Your Trade Offer, Please Wait..");
manager.getUserInventoryContents(client.steamID.getSteamID64(), CONFIG.KEYSFROMGAME, 2, true, (ERR, INV, CURR) => {
if (ERR) {
console.log("## An error occurred while getting inventory: " + ERR);
client.chatMessage(SENDER, "[Error] An error occurred while loading your inventory. Is it private?");
} else {
// console.log("DEBUG#INV LOADED");
if (!ERR) {
// console.log("DEBUG#INV LOADED NOERR");
for (let i = 0; i < INV.length; i++) {
if (theirKeys.length < n && CONFIG.ACCEPTEDKEYS.indexOf(INV[i].market_hash_name) >= 0) {
theirKeys.push(INV[i]);
}
}
if (theirKeys.length != n) {
/*error*/
client.chatMessage(SENDER, "[Error] You don't have enough keys: " + theirKeys.length + " / " + n);
console.log("[Buy] Not enough Keys:" + theirKeys.length + " / " + n);
} else {
// console.log("DEBUG#SENDING");
manager.getInventoryContents(753, 6, true, (err, MySteamInventory) => {
if (err) {
return console.log("[" + getTime() + "] " + err);
}
let MyGems = MySteamInventory.filter(gem => gem.name == "Gems");
if (MyGems === undefined || MyGems.length == 0) {
console.log("[" + getTime() + "] " + "[Error][Gems4Sets] Bot out of Gems.");
client.chatMessage(SENDER, "[Error] Sorry, I don't have enough Gems to buy your Sets: 0 / " + GemsToGive);
return;
} else {
let gem = MyGems[0];
let gemDifference = GemsToGive - gem.amount;
if (gemDifference <= 0) {
gem.amount = GemsToGive;
t.addMyItem(gem);
t.data("commandused", "BuyTF4GEMS");
console.log("!BuyTF4Gems " + n + " - SENT");
t.data("amountofgems", n.toString());
t.data("amountofkeys", n);
t.send((ERR, STATUS) => {
if (ERR) {
/*error*/
client.chatMessage(SENDER, "[Error] I'm Refreshing my inventory! Please try again in a few seconds.");
console.log("## An error occurred while sending trade: " + ERR);
} else {
console.log("[!Sell4Gems] Trade Offer Sent!");
}
});
} else {
client.chatMessage(SENDER, "[Error] Sorry, I don't have enough Gems to buy your Keys: " + MyGems[0].amount + " / " + GemsToGive + "\r\n Try using !Sell4Gems " + Math.floor(MyGems[0].amount / CONFIG.CARDS.GEM4TF));
}
}
});
}
} else {
console.log("## An error occurred while getting user inventory: " + ERR);
}
}
});
}
});
} else {
/*error*/
client.chatMessage(SENDER, "[Error] Please make sure you don't have a trade hold!");
}
};
} else {
client.chatMessage(SENDER, "[Error] You can only sell up to " + CONFIG.MESSAGES.MAXSELL + " at a time!");
}
} else {
client.chatMessage(SENDER, "[Error] Please enter a valid amount of Keys you wanna sell!");
} else {
client.chatMessage(SENDER, "[Error] Please try again later.");
}
to jest wyrywek z którym mam problem po nim jest następny else if