ahmet Posted October 26, 2020 Report Share Posted October 26, 2020 checks the user's gems and sends a trade offer. but I want the bot to add 1 gems to the trade offer created, but it always gives an error. I'm trying to do this with the following code trying to add 1 ore from the bot's inventory offer.addMyItems(item.amount = 1); I want the bot to add 1 gems to the trade offer. How can I do that? My Codes; case "gems": community.getUserInventory(partner, 753, 6, true, (error, items) => { if(error) { users.removeReservation(partner, true, removeFunc); return callback(error); } let accepted = files.getConfig().steamGems; var botgems = 0; var need = price; for (var i = 0; i < items.length; i += 1) { var item = items[i]; if (need !== 0) { if (accepted.indexOf(item.market_hash_name) >= 0) { item.amount = need <= item.amount ? need : item.amount; need -= item.amount; botgems += item.amount; } } offer.addTheirItem(item); offer.addMyItems(item.amount = 1); if(botgems == price) break; } if(botgems < price) { users.removeReservation(partner, true, removeFunc); return callback("/quote You do not have enough gems to purchase unique games."); } if(botgems > price) { users.removeReservation(partner, true, removeFunc); return callback("/quote ❌ An error occurred, please try again later."); } offer.send((error, status) => { if(error) { users.removeReservation(partner, true, removeFunc); return callback(error); } if(status == "pending") { community.acceptConfirmationForObject(files.getConfig().identity, offer.id, error => { if(error) { users.removeReservation(partner, true, removeFunc); return callback(error); } callback(null, "https://steamcommunity.com/tradeoffer/" + offer.id); }); } else if(status == "sent") callback(null, "https://steamcommunity.com/tradeoffer/" + offer.id); }); }); break; Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted October 26, 2020 Report Share Posted October 26, 2020 You can't do offer.addMyItems(item.amount = 1) You need to do it like this: item.amount = 1; offer.addMyItem(item); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.