Search the Community
Showing results for tags 'node-steam-tradeoffer-manager'.
-
Hello, I am getting this error: Error: There was an error sending your trade offer. Please try again later. (26) at exports.makeAnError (/home/hamaad/projects/cs-go/backend/node_modules/steam-tradeoffer-manager/lib/helpers.js:17:12) at SteamCommunity.<anonymous> (/home/hamaad/projects/cs-go/backend/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:349:12) at Request._callback (/home/hamaad/projects/cs-go/backend/node_modules/steamcommunity/components/http.js:67:15) at self.callback (/home/hamaad/projects/cs-go/backend/node_modules/request/request.js:185:22) at Request.emit (node:events:514:28) at Request.<anonymous> (/home/hamaad/projects/cs-go/backend/node_modules/request/request.js:1154:10) at Request.emit (node:events:514:28) at Gunzip.<anonymous> (/home/hamaad/projects/cs-go/backend/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:628:28) at Gunzip.emit (node:events:514:28) { eresult: 26 } I know that this error occurs when there is items in the inventory don't exist, but I cant find the problem in my code: const express = require('express'); const session = require('express-session'); const cookieParser = require('cookie-parser'); const passport = require('passport'); const SteamUser = require('steam-user'); const SteamStrategy = require('passport-steam').Strategy; const SteamCommunity = require('steamcommunity'); const SteamInventory = require('get-steam-inventory'); const TradeOfferManager = require('steam-tradeoffer-manager'); const crypto = require('crypto'); const cors = require('cors'); const app = express(); const PORT = 8080; const STEAM_API_KEY = '<API KEY>'; let community = new SteamCommunity(); let manager = new TradeOfferManager({ community: community, language: 'en', }); let client = new SteamUser(); client.logOn({ accountName: '<USERNAME>', password: '<PASSWORD>', }); manager.on('sessionExpired', function (err) { client.webLogOn(); }); client.on('webSession', (sessionID, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); }); const httpServer = require('http').createServer(app); const sessionSecret = crypto.randomBytes(32).toString('hex'); app.use( session({ secret: sessionSecret, resave: true, saveUninitialized: true }) ); app.use((req, res, next) => { res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Credentials', 'true'); res.setHeader( 'Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS' ); res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization'); next(); }); app.use( cors({ origin: ['http://localhost:3000', 'http://localhost:3001'], methods: 'GET,POST,PATCH,PUT,DELETE', credentials: true, }) ); app.use(cookieParser()); app.use(passport.initialize()); app.use(passport.session()); const io = require('socket.io')(httpServer, { cors: { origin: ['http://localhost:3000', 'http://localhost:3001'], methods: 'GET,POST,PATCH,PUT,DELETE', credentials: true, }, }); try { io.on('connection', (socket) => { io.to(socket.id).emit('connected'); }); } catch (error) { console.log(error); } passport.use( new SteamStrategy( { returnURL: 'http://localhost:8080/auth/steam/return', realm: 'http://localhost:8080/', apiKey: STEAM_API_KEY, }, function (identifier, profile, done) { process.nextTick(function () { profile.identifier = identifier; return done(null, profile); }); } ) ); passport.serializeUser(function (user, done) { done(null, user); }); passport.deserializeUser(function (obj, done) { done(null, obj); }); app.get('/auth/steam', passport.authenticate('steam')); app.get( '/auth/steam/return', passport.authenticate('steam', { failureRedirect: '/' }), (req, res) => { res.redirect('http://localhost:3000/'); } ); function isAuthenticated(req, res, next) { console.log(req.isAuthenticated(), 'auth'); if (req.isAuthenticated()) { return next(); } res.redirect('/'); } app.get('/user', isAuthenticated, (req, res) => { try { res.json({ user: req?.user?._json }); } catch (error) { res.json({ message: error.message }); } }); app.get('/inventory', isAuthenticated, async (req, res) => { const steamId = req?.user?._json?.steamid; SteamInventory.getinventory(730, steamId, '2') .then((data) => { res.json({ invetory: data }); }) .catch((err) => res.send(err)); }); let coinflipRooms = []; io.on('connection', (socket) => { const sendRoomsInterval = 5000; function sendRooms() { socket.emit('getCoinFlipRooms', coinflipRooms); } const sendRoomsTimer = setInterval(sendRooms, sendRoomsInterval); socket.on( 'createCoinflipRoom', ({ roomId, player, invertoryItem, roomOwner, coin, tradeUrl }) => { const owner = { player, invertoryItem, roomOwner, coin, tradeUrl }; const room = { roomId, players: [owner] }; coinflipRooms.push(room); socket.emit('coinflipRoomCreated', room); // Notify all clients about the new room } ); socket.on( 'joinCoinflipRoom', ({ roomId, player, invertoryItem, roomOwner, coin, tradeUrl }) => { if (coinflipRooms.length === 0) { io.emit(`coinFlipRoomError${player.steamId}`, 'Room not found'); } else { const joinedPlayer = { player, invertoryItem, roomOwner, coin, tradeUrl }; coinflipRooms.forEach((room) => { if (room.roomId === roomId) { room.players.push(joinedPlayer); } }); socket.emit('coinflipPlayerJoined', coinflipRooms); // Notify all clients in the room about the new player const selectWinnerInterval = 3000; async function selectRandomPlayer(room) { const randomIndex = Math.floor(Math.random() * room?.players.length); const randomPlayer = room?.players[randomIndex]; // Winner const loserPlayer = room?.players.find( (player) => player !== randomPlayer ); socket.emit('coinflipWinner', randomPlayer); const removedCurrectRoom = coinflipRooms.filter( (obj) => obj?.roomId !== room?.roomId ); coinflipRooms = removedCurrectRoom; // Transfer items to the winner const offer = manager.createOffer(randomPlayer?.player?.tradeUrl); console.log('Adding: '); console.log(loserPlayer?.invertoryItem[0].asset); offer.addTheirItem(loserPlayer?.invertoryItem[0].asset); offer.setMessage( `You won the coinflip! Your items: ${loserPlayer?.invertoryItem}` ); offer.send(async function (err, status) { if (err) { console.log(err); return; } if (status == 'pending') { console.log(`Offer #${offer.id} sent, but requires confirmation`); community.acceptConfirmationForObject( await getIdentitySecret(loserPlayer?.player?.steamid), offer.id, function (err) { if (err) { console.log(err); } else { console.log('Offer confirmed'); } } ); } else { console.log(`Offer #${offer.id} sent successfully`); } }); } const autoWinnerTimer = setInterval( () => selectRandomPlayer(coinflipRooms.find((room) => room.roomId === roomId)), selectWinnerInterval ); } } ); socket.on('disconnect', () => { console.log('user disconnected'); clearInterval(autoRoomTimer); clearInterval(autoWinnerTimer); }); process.on('SIGINT', () => { clearInterval(autoRoomTimer); clearInterval(autoWinnerTimer); process.exit(); }); }); httpServer.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); });
-
Hello. I have node bot like this which starts via directing to the file and then need to type node bot.js and it sends items from first bot to second and then vice versa but there are a lot of crashes which demolishes my brain. now I have found https://github.com/DoctorMcKay/node-steam-tradeoffer-manager but there is something different, how to run the bot, it seems this is for site but not really sure. can someone help me to configure and run step by step this bot correctly and inform how it works? Regards.
-
What should I do?
-
Sometimes pollFailure event is emitted and gives the error below. { Error: socket hang up at createHangUpError (_http_client.js:323:15) at TLSSocket.socketOnEnd (_http_client.js:426:23) at TLSSocket.emit (events.js:203:15) at endReadableNT (_stream_readable.js:1145:12) at process._tickCallback (internal/process/next_tick.js:63:19) code: 'ECONNRESET' } My script is running on AWS. So there shouldn't be any issues with the network.
-
Hello, i have a problem with multiple TradeOfferManagers, in this example the first console.log returns a name for a different account then the second console.log. How is this possible? let offer = managers[x].createOffer(new SteamID(steamId), token); offer.getUserDetails((err, me, them) => { console.log(me.personaName); console.log(managers[x].steamID.getSteamID64());
-
const client = new SteamUser();client.setOption("localAddress",logInConfig.publicIP);const logInOptions = { accountName: logInConfig.accountName, password: logInConfig.password, twoFactorCode: SteamTotp.generateAuthCode(logInConfig.sharedSecret)}; const community = new SteamCommunity({ localAddress:logInConfig.publicIP});const manager = new TradeOfferManager({ steam: client, community: community, language: "en", cancelOfferCount: 30});client.logOn(logInOptions);Will the manager use the logInConfig.publicIP?
-
const manager = new TradeOfferManager({ steam: client, community: community, language: "en"}); manager.on("sentOfferChanged ", function (offer,oldState) { console.log(`Sent offer changed:` + offer.state);}); sentOfferChanged doesnt emit, the only time it emits something is when I send an offer that needs to be confirmed (ETradeOfferState = 9). Do I have to call doPoll() manually or Iam missing something?
-
I've fixed the issue. It was ``addTheirItem`` instead of ``addMyItem``.
-
Just since 8 hours ago, my bot stop working, it does not accept trade-offers. so when I tried to restart it, I get stuck in setCookies() portion, it gives error 403. I logged in my accounts, check community market, I can purchase just fine. Checked badge pages, can craft just fine. It seems all of my accounts that I idle in ASF stopped working too.
-
Hello, I've had code I was using frequently about ~1 year ago. Rerunning the code today, I get the Steam Error Code 55 on every trade offer I try to send. I've updated all the packages, code hasn't changed a bit. Could anyone provide an explanation of what error code 55 "Remote Call Failed" means? Thanks.
-
I have a function that runs on average about 2 minutes. console.log(currentTime() + " START"); community.getSteamUser... if (DATA.onlineState == "online"... let trade = manager.createOffer... manager.getUserInventoryContents... for (let i in BotSets.BaseSets) {.... } for (let i in BotSets.FoilSets) {.... } // ---------------------------- INV = INV.filter((ITEM) => ITEM.getTag("item_class").internal_name == "item_class_2"); console.log(currentTime() + " TEST, STEP 05-A"); INV = INV.filter((ITEM) => ITEM.market_hash_name.indexOf("470480-Messenger") == -1); for (let i = 0; i < INV.length; i++) { if (i == 5000) console.log(currentTime() + " TEST, ITEMS CHECKED: 5,000"); if (i == 40000) console.log(currentTime() + " TEST, ITEMS CHECKED: 40,000"); if (i == 50000) console.log(currentTime() + " TEST, ITEMS CHECKED: 50,000"); if (i == 60000) console.log(currentTime() + " TEST, ITEMS CHECKED: 60,000"); if (i == 70000) console.log(currentTime() + " TEST, ITEMS CHECKED: 70,000"); if (i == 80000) console.log(currentTime() + " TEST, ITEMS CHECKED: 80,000"); if (i == 90000) console.log(currentTime() + " TEST, ITEMS CHECKED: 90,000"); if (i == 100000) console.log(currentTime() + " TEST, ITEMS CHECKED: 100,000"); if (i == 110000) console.log(currentTime() + " TEST, ITEMS CHECKED: 110,000"); if (amount < CONFIG.LIMITS.MAXTRANSFERCARDS && !idList.includes(INV[i].assetid)) { trade.addMyItem(INV[i]); amount++; } else if (amount == CONFIG.LIMITS.MAXTRANSFERCARDS && !idList.includes(INV[i].assetid)) { reachedLimit = true; break; } } console.log(currentTime() + " TEST, STEP 05-B"); // ---------------------------- trade.send((ERR) => { .... In the end, I get: 23:24 START 23:25 TEST, STEP 05-A 23:25 TEST, ITEMS CHECKED: 5,000 23:25 TEST, ITEMS CHECKED: 40,000 23:26 TEST, ITEMS CHECKED: 50,000 23:26 TEST, ITEMS CHECKED: 60,000 23:26 TEST, ITEMS CHECKED: 70,000 // >> here I see that the bot goes offline 23:26 TEST, ITEMS CHECKED: 80,000 23:26 TEST, ITEMS CHECKED: 90,000 23:27 TEST, STEP 05-B 23:27 Error: HTTP error 401 23:27 client.steamID: null 23:27 (WAIT FOR RECONECT) 23:27 An error occurred while sending trade offer: Error: Not Logged In 23:27 (Login...) Sometimes this function works, about 50/50%, but lately very often the bot goes offline before the trade offer is sent. Are there any tips, how can I prevent the bot from shutting down while this function is running?
-
How can I find out what item the user wants to receive? 1. I want to continue if item name = "Abc name Trading Card" 2. If not, decline assetid/classid change very often and the code stops working. manager.on("newOffer", (OFFER) => { console.log(OFFER); if (OFFER.itemsToGive.length == 1 && (OFFER.itemsToGive[0].id == "10964018350" || OFFER.itemsToGive[0].id == "11724177271" )) { // accept TradeOffer { partner: SteamID { universe: 1, type: 1, instance: 1, accountid: 23587203 }, id: '3695907410', message: '', state: 2, itemsToGive: [ EconItem { appid: 753, contextid: '6', assetid: '11497188550', classid: '2238354881', instanceid: '0', amount: 1, missing: false, est_usd: '7', id: '11497188550', fraudwarnings: [], descriptions: [], owner_descriptions: [], actions: [], owner_actions: [], market_actions: [], tags: [], tradable: false, marketable: false, commodity: false, market_tradable_restriction: 0, market_marketable_restriction: 0 } ], itemsToReceive: [], isOurOffer: false, created: 2019-09-04T11:04:43.000Z, updated: 2019-09-04T11:04:43.000Z, expires: 2019-09-18T11:04:43.000Z, tradeID: null, fromRealTimeTrade: false, confirmationMethod: 0, escrowEnds: null, rawJson: '{\n\t"tradeofferid": "3695907410",\n\t"accountid_other": 23587203,\n\t"message": "",\n\t"expiration_time": 1568804683,\n\t"trade_offer_state": 2,\n\t"items_to_give": [\n\t\t{\n\t\t\t"appid": 753,\n\t\t\t"contextid": "6",\n\t\t\t"assetid": "11497188550",\n\t\t\t"classid": "2238354881",\n\t\t\t"instanceid": "0",\n\t\t\t"amount": "1",\n\t\t\t"missing": false,\n\t\t\t"est_usd": "7"\n\t\t}\n\t],\n\t"is_our_offer": false,\n\t"time_created": 1567595083,\n\t"time_updated": 1567595083,\n\t"from_real_time_trade": false,\n\t"escrow_end_date": 0,\n\t"confirmation_method": 0\n}' } However, I see no way to get the name (without loading all inventory). Is there any way to get the name of the items like getReceivedItems, but for itemsToGive? (And I also wanted to know why tradable = false)
-
I want to keep track of what item I have sent to a partner. For an example: I have 10 SAME* items that I want to giveaway to random users. But I need to track which item I have sent, so I don't send 1 unique item to 2 persons as a trade offer. * By same I mean items with the same market_hash_name So my questions are: does assetid change? can I use just "id" to track which items I have sent? can an item have no assetid? can one or more items have the same assetid in ONE inventory Thanks in advance
-
var offer = manager.createOffer(partnerId);offer.getUserDetails(function (err, them) {if(err){console.log(`Error getting trade info of partnerId; ${partnerId}\nerr:${err}`);}else{console.log(them.escrowDays);console.log(them.contexts);}}); Before I want to send an offer, I want to check the partner inventory. what will console.log(them.contexts); print? I can't test it because my bot account can't trade till 15 days are passed. Does it just print the contexts of the games that the partner have? If this is the case, is manager.getUserInventoryContents the way to get trade?
- 1 reply
-
- node.js
- node-steam-tradeoffer-manager
-
(and 2 more)
Tagged with:
-
Hi my bot doesnt accept offers, i dont know why. My code:
-
now,i use this ways, first accept all offer, then i send a message to my bot ,to confirm i want offer if (message.indexOf("@confirm") >=0) { if (steamID == Config.admin) { community.acceptConfirmationForObject(Config.identity, message.replace("@confirm ",""), function(err){ if(err){ console.log(' Cant confirmed the offer. Please try again later'); client.chatMessage(Config.admin, "HI admin: Cant confirmed the offer"); } else { console.log(' Succesfully confirmed the offer.'); client.chatMessage(Config.admin, "HI admin: Offer was successful"); } }); } } now how can i send a message to make my bot accept offer or decline offer? may be i can accept all offer and then i send confirm message to finish i want trade and every 2hours decline all offer to decline i needn't offer please help
-
Question Error: cannot send an empty trade offer.
Kappa posted a topic in node-steam-tradeoffer-manager
Hey there, I'm such a newbie in steambot coding. The main objective of the code would be that the bot should request a cs:go / tf2 key from a user who sends the command "!order" via trade offers. My current state is that the bot creates the offer but there's always an error because I get the error: "Cannot send an empty trade offer." Is there anything which I'm too blind to see? Thanks in advance! My code: function checkKeys(steamID) { var theirKeys = []; var amountOfKeysToAdd = 1; manager.getUserInventoryContents(steamID, config.keysFromCSGO && config.keysFromTF2, 2, true, function(err, inventory) { if (err) { console.log('Error getting user inventory.'.red); } else { console.log('Checking if user has CS:GO or TF2 keys.'.green); for (var n = 0; n < inventory.length; n++) { if(theirKeys.length < amountOfKeysToAdd && config.acceptedKeys.indexOf(inventory[n].market_hash_name) >= 0) { theirKeys.push(inventory[n]); console.log(inventory[n].market_hash_name); } } console.log('User has' + theirKeys.length + 'key(s).'); } }); } function sendOffer(sender) { let theirKeys = []; var offer = (manager.createOffer(sender.getSteamID64())); offer.addTheirItems(theirKeys); offer.send ((err, status) => { if (err) { console.log('There was an error sending the offer.'.red + err); } else { console.log('An offer has been sent.'.green); console.log(status); } }); } client.on('friendMessage', (sender, message) => { if (message === "!start") { client.chatMessage(sender, config.startMessage); } else if (message === "!owner") { client.chatMessage(sender, config.ownerMessage); } else if (message === "!help") { client.chatMessage(sender, config.helpMessage); } else if (message === "!order") { client.chatMessage(sender, config.orderMessage); client.chatMessage(sender, 'Processing your request....'); checkKeys(sender); console.log('Creating offer...'.cyan); sendOffer(sender); } else if (message === "!proof") { client.chatMessage(sender, config.proofMessage); } }); -
I want to create bot with automatic sending spesific trading card with spesific input //the conversation A: !badges 570 2 BOT: Sending 2sets of Dota 2 A: !badges 440 5 BOT: Sending 5sets of Team Fortress 2 //my spesific input ... client.on("friendMessage", function(steamID, message) { var msg; if (steamID == account.owner){ ... else if (msg = message.match(/^!badges(\d+) (\d+))) { var appID = msg[1]; var count = msg[2]; client.chatMessage(steamID, "..."); } } else{ ... } ... Can anyone help me to get the code?
-
Hi, if someone can help me out with this i dont rl know how to build this and i created such a mess here with all of this code... I tryed to search up everywhere and i cant find similar problem... I have prices database in database.json file witch bot loads and then u can acces to !prices <item name>, similar to that i created !buy <item name> command witch is triggered when user insert name of item witch exist in database.json and in bots inventory(inventory.json)... After that bot needs to create offer with this items witch are selected...There i start having some issues. Down is my messed code if someone can explain what im doing wrong, and how i can make trade offer with selected items for price thats inside of database by chat command ? } else if (command === "!buy" && itemName) { const database = JSON.parse(fs.readFileSync('./database.json', 'utf8')); if(database[itemName]) { const buyPrice = database[itemName].sell; const sellPrice = database[itemName].sell.metal let offer = manager.createOffer("https://steamcommunity.com/tradeoffer/new/?partner=12345678&token=xxxxxxxx"); let t = manager.createOffer(steamID.getSteamID64()); t.getUserDetails((ERR, ME, THEM) => { if (ERR) { console.log("## An error occurred while getting trade holds: " + ERR); client.chatMessage(steamID, "An error occurred while getting your trade holds. Please try again"); } else if (ME.escrowDays == 0 && THEM.escrowDays == 0) { client.chatMessage(steamID, "Processing your request."); manager.getUserInventoryContents(steamID.getSteamID64(), 440, 2, true, (ERR, INV, CURR) => { offer.addTheirItems(INV); offer.addMyItems(INV); var MyItems = require(`./Inventory.JSON`); offer.send(function(err, status) { }, client.chatMessage(steamID, "Prepairing offer...")); if (ETradeOfferState == 12) { console.log(`Offer #${offer.id} sent, but requires confirmation`); community.acceptConfirmationForObject("identitySecret", offer.id, function(err) { if (err) { console.log(err); } else { console.log("Offer confirmed"); } }); } else { console.log(`Offer #${offer.id} sent successfully`); client.chatMessage(steamID, `Trade offer created ! [ offer ID: ${offer.id} ]`); } if (ERR) { console.log("## An error occurred while getting inventory: " + ERR); client.chatMessage(steamID, "An error occurred while loading your inventory. Please try later, or check if your inventory isnt on private ! \n If is that not case error is caused by Steam servers witch seems to be offline... \n Try to sent offer with up given price at link:\n https://steamcommunity.com/tradeoffer/new/?partner=xxxxxxxx "); } }); } });
-
Discussion Possible ram usage improvement in module
Blue posted a topic in node-steam-tradeoffer-manager
I was doing some tests in one of my projects that use this module, and i noticed that de polling sometimes requests to much ram, after get further the module in github, the "problem", seems to be that to much information is cached in the LeastUsedCache(), this happens only when there is a that bot account has to many items i suppose.. so having that in mind, i have a question that can possibly lower the ram usage, what if we use a mongoDB or something alike to store that data intead(as an option to implement of course), this would only be useful in some cases like mine, but it might improve a little the ram usage, and also would be possible to store more data for more time if needed.. i could have did it myself and test it to see if is worth it, but i'd rather see you guys thoughts first, and also the possibility of this to be implemented in the module by the @Doctor himself, if the results seems to be good -
I cant seem to find a craft-able property in the econ item object can someone point to it in this object bellow, thanks! EconItem {appid: 440, contextid: '2', assetid: '7846925808', classid: '11040732', instanceid: '11040552', amount: 1, missing: false, est_usd: '92', icon_url: 'fWFc82js0fmoRAP-qOIPu5THSWqfSmTELLqcUywGkijVjZULUrsm1j-9xgEYeQocWAndqzBCjM31Mv6NGucF1Yps5MQEjDM6xlF5Y7uwMjQxIlfHVaEOXqNso1rpCnJmuZ5hUIaw8blIOVK4ag0bm_o', icon_url_large: 'fWFc82js0fmoRAP-qOIPu5THSWqfSmTELLqcUywGkijVjZULUrsm1j-9xgEYeQocWAndqzBCjM31Mv6NGucF1Yps5MQEjDM6xlF5Y7uwMjQxIlfHVaEOXqNso1rpCnJmuZ5hUIaw8blIOVK4ag0bm_o', icon_drag_url: '', name: 'Summer Shades', market_hash_name: 'Summer Shades', market_name: 'Summer Shades', name_color: '7D6D00', background_color: '3C352E', type: 'Limited Level 10 Glasses', tradable: true, marketable: true, commodity: false, market_tradable_restriction: 7, market_marketable_restriction: 0, fraudwarnings: [], descriptions: [ { type: 'text', value: 'These are famous.', app_data: '' } ], actions: [ { name: 'Item Wiki Page...', link: 'http://wiki.teamfortress.com/scripts/itemredirect.php?id=486&lang=en_US'}, { name: 'Inspect in Game...', link: 'steam://rungame/440/76561202255233023/+tf_econ_item_preview%20S%owner_steamid%A%assetid%D2327250644315844062' } ], market_actions: [ { name: 'Inspect in Game...', link: 'steam://rungame/440/76561202255233023/+tf_econ_item_preview%20M%listingid%A%assetid%D2327250644315844062' } ], tags: [ { internal_name: 'Unique', name: 'Unique', category: 'Quality', color: '7D6D00', category_name: 'Quality', localized_tag_name: 'Unique', localized_category_name: 'Quality' }, { internal_name: 'misc', name: 'Cosmetic', category: 'Type', category_name: 'Type', localized_tag_name: 'Cosmetic', color: '', localized_category_name: 'Type' }, { internal_name: 'Scout', name: 'Scout', category: 'Class', category_name: 'Class', localized_tag_name: 'Scout', color: '', localized_category_name: 'Class' }, { internal_name: 'Sniper', name: 'Sniper', category: 'Class', category_name: 'Class', localized_tag_name: 'Sniper', color: '', localized_category_name: 'Class' }, { internal_name: 'Soldier', name: 'Soldier', category: 'Class', category_name: 'Class', localized_tag_name: 'Soldier', color: '', localized_category_name: 'Class' }, { internal_name: 'Demoman', name: 'Demoman', category: 'Class', category_name: 'Class', localized_tag_name: 'Demoman', color: '', localized_category_name: 'Class' }, { internal_name: 'Medic', name: 'Medic', category: 'Class', category_name: 'Class', localized_tag_name: 'Medic', color: '', localized_category_name: 'Class' }, { internal_name: 'Heavy', name: 'Heavy', category: 'Class', category_name: 'Class', localized_tag_name: 'Heavy', color: '', localized_category_name: 'Class' }, { internal_name: 'Pyro', name: 'Pyro', category: 'Class', category_name: 'Class', localized_tag_name: 'Pyro', color: '', localized_category_name: 'Class' }, { internal_name: 'Spy', name: 'Spy', category: 'Class', category_name: 'Class', localized_tag_name: 'Spy', color: '', localized_category_name: 'Class' }, { internal_name: 'Engineer', name: 'Engineer', category: 'Class', category_name: 'Class', localized_tag_name: 'Engineer', color: '', localized_category_name: 'Class' } ], app_data: { def_index: '486', quality: '6', slot: 'Cosmetic', filter_data: { '931505789': [Object], '1662615936': [Object] }, player_class_ids: { '0': '1', '1': '2', '2': '3', '3': '4', '4': '5', '5': '6', '6': '7', '7': '8', '8': '9' }, highlight_color: '7a6e65' }, id: '7846925808', owner_descriptions: [], owner_actions: [] }
-
I get a number of different errors when running the bot and they are always to do with the offers. This is what I have so far with the new offer for a stranger and the owner offer stuff. Just to let anyone know this bot sells TF2 Scrap for Steam Emoticons. The Code: manager.on('newOffer', (offer) => { let counter = 0 if (offer.itemsToGive.length == offer.itemsToReceive.length) { for (let i = 0; i < offer.itemsToGive.length; i++) { if (offer.itemsToReceive[i].type.includes("Emoticon") && offer.itemsToGive[i].name == "Scrap Metal") { counter++ } } if (counter == offer.itemsToGive.length) { offer.accept(function(err, status) { if (err) { console.log("Unable to accept offer: " + err.message); } else { console.log("Offer accepted: " + status); if (status == "pending") { community.acceptConfirmationForObject(config.identity, offer.id, function(err) { if (err) { console.log("Can't confirm trade offer: " + err.message); } else { console.log("Trade offer " + offer.id + " confirmed"); } }) } } }) } } else 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).'); } }); } }); //owner send trade, bot instantly accepts manager.on('newOffer', (offer) => { if (offer.partner.getSteamID64() === config.ownerID) { acceptOffer(offer); console.log("Successfully accepted") } else { delcineOffer(offer); } }); Some examples of errors I get, "Cannot read property 'partner' of undefined" that error is from the owner code. Then when removing that code the bot works, but it means I cannot send trades as the owner with out logging onto the bot's account and accepting it manually. I hope someone can help me. Thanks Unmet
- 1 reply
-
- node.js
- node-steam-tradeoffer-manager
- (and 5 more)
-
I would like to create a function that returns the getOffers object.when ever I console.log my loadTrades function i get undefined. I am new to coding especially aysnc. how could i write this better? const loadTrades = function(callback){ manager.getOffers('ActiveOnly',(err,received)=>{ if(err){ console.log(err) } else { callback(received); } });} manager.on('newOffer',()=>{ // expecting to console log the getOffers object console.log(loadTrades((received)=>{return received})); });
-
Hello. I have the function below which gets an item id by calling the inventory, then seeing which item's name is correct and then returns the id, however when i return the ID, it does not show correctly: it shows undefined. I have tried both .assetid and .id But when i put in the function console.log(inventory.assetid) it logs the id, but when i call the function it doesnt return the id! Please halp thank you function getID(itemname) { manager.getInventoryContents(440, 2 , true, function(err, inventory) { if (err) { console.log(err) return; } else { //console.log(inventory); for (var i = 0; i < inventory.length; i++) { if (inventory.market_hash_name === itemname) { return inventory.id; } } } })
-
Error: Descriptions: Invalid API response at Helpers.checkNeededDescriptions (F:\apps\WPB\bots\node_modules\steam-tradeoffer-manager\lib\index.js:497:14) at Async.map (F:\apps\WPB\bots\node_modules\steam-tradeoffer-manager\lib\assets.js:166:5) at F:\apps\WPB\bots\node_modules\async\dist\async.js:1126:9 at F:\apps\WPB\bots\node_modules\async\dist\async.js:473:16 at iteratorCallback (F:\apps\WPB\bots\node_modules\async\dist\async.js:1048:13) at F:\apps\WPB\bots\node_modules\async\dist\async.js:958:16 at F:\apps\WPB\bots\node_modules\async\dist\async.js:1123:13 at Async.each (F:\apps\WPB\bots\node_modules\steam-tradeoffer-manager\lib\assets.js:159:6) at F:\apps\WPB\bots\node_modules\async\dist\async.js:473:16 at iteratorCallback (F:\apps\WPB\bots\node_modules\async\dist\async.js:1048:13) My bots was worked perfectly until a few minutes ago. This new error happen each time the try to poll the data. And I get "ServiceUnavailable" message when I am trying to make a trade. But Steam status is ok: Some idea?