Hello there.
I seem to be having a problem when attempting to send a Trade Offer. The items seem to be added to the trade okay, but when it comes to actually sending the trade, I get the error:
\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:526
callback(null, 'pending');
^
TypeError: callback is not a function
at SteamCommunity.<anonymous> (C:\Users\Alex\Desktop\SteamBot Files\NODE JSBTC KEY BOT\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:526:4)
at Request._callback (\node_modules\steamcommunity\components\http.js:62:14)
at Request.self.callback (\node_modules\steamcommunity\node_modules\request\request.js:200:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request.<anonymous> (\node_modules\steamcommunity\node_modules\request\request.js:1067:10)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (\node_modules\steamcommunity\node_modules\request\request.js:988:12)
at emitNone (events.js:72:20)
My code for sending the trade offer is:
function sendCrates(steamID, amount) {
if (!amount) {
return true;
}
offers.loadInventory(appid.CSGO, contextid.CSGO, true, function (err, inventory) {
if (err) {
logger.error(err);
} else {
var pool = inventory.filter(function (item) {
return item.tags.some(function(element, index, array) {
return element.internal_name == "CSGO_Tool_WeaponCase_KeyTag";
});
});
if (pool.length === 0) {
client.chatMessage(steamID, "We don't have any keys available. Sorry!");
return true;
} else if (amount > pool.length) {
logger.debug('User requested ' + amount + ' of keys. I only have ' + pool.length + ' available.');
client.chatMessage(steamID, 'I only have ' + pool.length + ' keys available. Sorry about that.');
amount = pool.length;
}
var finalAddTradeItems = [];
var trade = offers.createOffer(steamID);
logger.debug('Adding ' + amount + ' keys to trade offer for ' + steamID);
for (var i = 0; i <= amount-1; i++) {
finalAddTradeItems[i] = pool[i];
if(i == (amount-1)) {
trade.addMyItems(finalAddTradeItems);
break;
};
};
trade.send('Here are the keys you asked for!', function (err, status) {
if (err) {
logger.error(err);
client.chatMessage(steamID, 'Something went wrong when trying to send the trade offer. Steam message: ' + err);
} else if (status == 'pending') {
logger.info('Trade offer sent to ' + steamID + ' for ' + amount + ' keys.');
client.chatMessage(steamID, 'Trade offer sent. Awaiting mobile confirmation.');
SteamMobileConfirms(true, false, false, steamID, trade.id);
};
});
};
});
};
I couldn't find anything related to this in the past issues and everything on the internet is stating that I haven't got a callback, although I have.
I understand that my code is quite messy. I'm still relatively new to this.
Thank you in advance.
Edit: The trade is actually sending, as it goes to my Steam confirmation page.
Hello there. I seem to be having a problem when attempting to send a Trade Offer. The items seem to be added to the trade okay, but when it comes to actually sending the trade, I get the error:
My code for sending the trade offer is:
I couldn't find anything related to this in the past issues and everything on the internet is stating that I haven't got a callback, although I have. I understand that my code is quite messy. I'm still relatively new to this.
Thank you in advance.
Edit: The trade is actually sending, as it goes to my Steam confirmation page.