Jump to content
McKay Development

PlanZed

Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by PlanZed

  1. 1 hour ago, Dr. McKay said:

    The chatter's SteamID is available in the event that delivers you the chat message.

    I know this is a dumb question but how would I call the SteamID from the chat message?

    I have the code 

    client.chatMessage(steamID, "Setting up the trade offer for Test Item");
    const offer = manager.createOffer(steamID);

    Is this the correct way to call it?

  2. 1 hour ago, Dr. McKay said:

    You've cut out the actual error message.

    C:\Users\Valkyrie\Desktop\Trading Bot\node_modules\steamcommunity\components\users.js:491
                                    callback(null, inventory, currency, body.total_inventory_count);
                                    ^

    TypeError: callback is not a function
        at SteamCommunity.<anonymous> (C:\Users\Valkyrie\Desktop\Trading Bot\node_modules\steamcommunity\components\users.js:491:5)
        at Request._callback (C:\Users\Valkyrie\Desktop\Trading Bot\node_modules\steamcommunity\components\http.js:67:15)
        at Request.self.callback (C:\Users\Valkyrie\Desktop\Trading Bot\node_modules\request\request.js:185:22)
        at Request.emit (events.js:310:20)
        at Request.<anonymous> (C:\Users\Valkyrie\Desktop\Trading Bot\node_modules\request\request.js:1154:10)
        at Request.emit (events.js:310:20)
        at Gunzip.<anonymous> (C:\Users\Valkyrie\Desktop\Trading Bot\node_modules\request\request.js:1076:12)
        at Object.onceWrapper (events.js:416:28)
        at Gunzip.emit (events.js:322:22)
        at endReadableNT (_stream_readable.js:1187:12)

  3. I am currently creating a TF2 trading bot and I want it to be able to send trade offers but i keep getting this error 

    C:\Users\Valkyrie\Desktop\Trading Bot\node_modules\steamcommunity\components\users.js:491
                                    callback(null, inventory, currency, body.total_inventory_count);

    My main code is

    client.on("friendMessage", function(steamID, message) {
    	if (message == "!buy test item") {
    		client.chatMessage(steamID, "Setting up the trade offer for Test Item");
    		console.log("Someone typed in the command '!buy test item'");
    		const offer = manager.createOffer(steamID);
    		manager.loadInventory(440, 2, true, (err, inventory) => {
    			if (err) {
    				client.chatMessage("There was an error loading the inventory. Please try again. If the problem continues please message the owner by typing '!help'");
    				console.log(err);
    				console.log("There was an error loading my inventory.");
    			} else {
    				offer.getPartnerInventoryContents(440, 2, true, (err, inventory) => {
    					if (err) {
    						client.chatMessage("There was an error loading the inventory. Please try again. If the problem continues please message the owner by typing '!help'");
    						console.log(err);
    						console.log("There was an error loading their inventory.");
    					} else {
    						const offer = manager.createOffer(76561198083465811);
    						inventory.forEach(function(item) {
    							if (item.assetid === '30362') {
    								offer.addMyItem(item);
    								offer.addTheirItems(5002, 5002, 5001, 5001, 5000, 5000);
    								offer.setMessage("1 Law for 2.88 Refined");
    								offer.send(function(err, status) {
    									if (err) {
    										client.chatMessage("There was an error sending the trade offer. Please try again. If the problem continues please message the owner by typing '!help'");
    										console.log(err);
    										console.log("There was an error sending the trade offer.");
    									} else {
    										console.log(status);
    										console.log("The trade was sent successfully!");
    									}
    								})
    							}
    						})
    					}
    				})
    			}
    		})
    	}
    })

     

  4. I have been stuck on trying to figure out how have my bot send a trade offer with items the bot has for items the user has.

    For example (*this is a TF2 trading bot*) I have a hat, I want to sell it for 1 key by sending a trade offer. how would I do this?

     

    **I know how to accept one when the user sends the trade offer, but I want to implement being able to use a command in steam chat to have the bot send them a trade offer**

×
×
  • Create New...