I've tried resolving some issues like overflowwarning and managed to fix with "npm update", however I can't find the current issue after hours of looking. Help would be appreciated! :)
The console gets the error message "TypeError: callback is not a function
at TradeOfferManager. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\lib\index.js:75:3)
at TradeOfferManager. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\lib\index.js:103:3)
at Request._callback (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\steamcommunity\index.js:138:4)
at Request.self.callback (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\request\request.js:373:22)
at Request.emit (node:events:394:28)
at Request. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\request\request.js:1318:14)
at Request.emit (node:events:406:35)
at IncomingMessage. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\request\request.js:1266:12)
at IncomingMessage.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1329:12)"
I've tried resolving some issues like overflowwarning and managed to fix with "npm update", however I can't find the current issue after hours of looking. Help would be appreciated! :) The console gets the error message "TypeError: callback is not a function at TradeOfferManager. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\lib\index.js:75:3)
at TradeOfferManager. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\lib\index.js:103:3)
at Request._callback (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\steamcommunity\index.js:138:4)
at Request.self.callback (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\request\request.js:373:22)
at Request.emit (node:events:394:28)
at Request. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\request\request.js:1318:14)
at Request.emit (node:events:406:35)
at IncomingMessage. (C:\Users\Admin\node_modules\steam-tradeoffer-manager\node_modules\request\request.js:1266:12)
at IncomingMessage.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1329:12)"
My code: const SteamUser = require('steam-user'); const SteamTotp = require('steam-totp'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); const config = require('./config1.json')
const client = new SteamUser(); const community = new SteamCommunity(); const manager = new TradeOfferManager({ steam: client, community: community, language: 'en' });
const logOnOptions = { accountName: 'xxxx', password: 'xxxx', twoFactorCode: SteamTotp.generateAuthCode('xxxx') };
client.logOn(logOnOptions);
client.on('loggedOn', () => { console.log('Logged into Steam');
client.setPersona(SteamUser.EPersonaState.Online); client.gamesPlayed(730); });
client.on('webSession', (sessionid, cookies) => { manager.setCookies(cookies);
community.setCookies(cookies); community.startConfirmationChecker(10000, 'xxxx'); });
function sendRandomItem() { const partner = 'xxxx'; const appid = 730; const contextid = 2;
const offer = manager.createOffer(partner);
manager.loadInventory(appid, contextid, true, (err, myInv) => { if (err) { console.log(err); } else { const myItem = myInv[Math.floor(Math.random() * myInv.length - 1)]; offer.addMyItem(myItem);
}); }
manager.on('newOffer', offer => { if (offer.partner.getSteamID64() === '76561199184536525') { offer.accept((err, status) => { if (err) { console.log(err); } else { console.log(
Accepted offer. Status: ${status}.
); } }); } else { offer.decline(err => { if (err) { console.log(err); } else { console.log('Canceled offer.'); } }); } });function sendRandomItem() { manager.loadInventory(730, 2, true, (err, inventory) => { if (err) { console.log(err); sendRandomItem(); } else { const offer = manager.createOffer('xxxx'); const item = inventory[Math.floor(Math.random() * inventory.length - 1)];
}); }
manager.on('newOffer', offer => { if (offer.itemsToGive.length === 0) { offer.accept((err, status) => { if (err) { console.log(err); } else { console.log(
Donation accepted. Status: ${status}.
); } }); } else { offer.decline(err => { if (err) { console.log(err); } else { console.log('Donation declined (wanted our items).'); } }); } });