Jump to content
McKay Development

EnelGy

Member
  • Posts

    38
  • Joined

  • Last visited

Everything posted by EnelGy

  1. So the bot should be outside the laravel project and to communicate with it I need to install http and express to the bots file ? To be sure, Do I do something like this ? (This http request is in laravel) (port: 3000 is the bots http port) Http::post('http://localhost:3000/send', [ tradelink: tradelink, items: (some ids of items) ]); Then my bot get this and use posted array to create the trade offer ? I feel like this is so complicated and not very secure
  2. Hey, could someone tell me, how should I communicate with steam bot through laravel/vue.js ? Also where should I store the bots folder ? (I guess it should be somewhere outside the laravel project for better security and dont know how would I turn on the bot, but not sure, correct me if I am wrong) For instance when a user clicks some button, I want to create trade-offer (where my bot gives to the user some item) - bots folder is probably outside the laravel (not in laravel project, but somewhere in the server) - i can call some function or ajax request from the click, but dont know what exactly should I do, how to commuicate with the bot
  3. So this only doesn't work on localhost ?
  4. Currently, I am using vue.js and want to ask if is it possible to fetch users inventory using axios -> when i try this, it gives me these errors If is there any other way to achieve loading users inventory using vue/axios, please suggest me
  5. For the first request I make usual request $steam = "http://steamcommunity.com/inventory/" . $steamid . "/440/2?l=english?count=1000"; $json = file_get_contents($steam); $data = json_decode($json, true); Then I get more_items = 1; last_assetid=123 and I want to do another request which starts with the last_assetid. I know that next $steam should have ?start_assetid=123, but don't have any idea how Would I do it to keep the old content. Please suggest me
  6. @Dr. McKay Do I need any API to get users content of inventory ?
  7. I really dont know how is that possible... Earlier I have set offer.data('cancelTime', 120000); and after first succesfully completed trade, I was keeping getting this...the offer.state "Canceled" (all the time I restart my bot, first trade works, others it cancels) manager.getUserInventoryContents(offer.partner.getSteamID64(), 440, 2, true, function (err, myInv){ if (err) { console.log(err); } else { // I need to send X ref var volume = entryCost; // amount = number in args[0] // Filter out all the ref var ref = myInv.filter(function (item) { return item.market_hash_name.match("Refined Metal") }); console.log(ref.length); console.log(volume); // Let the user know we don't have enough ref if (ref.length < volume) { unmuteChannel(); console.log('Not enough Keys'); message.reply(notEnough); console.log('------------------------'); return true; // Give up } // Start a new trade offer // Add what we should do to the current trade console.log('Adding '+volume+' Keys'); offer.addTheirItems(ref.slice(0, volume)) // Send the offer offer.send(function (err, status){ if (err) { console.log(err); } else { console.log('Trade offer #'+ offer.id+ ' sent successfully'); // Register the offer id, save it to JSON file client.tradeLinks ['lastguy'] = { name: message.author.tag, tradelink: _message, lastoffer: offer.id } fs.writeFile ('tradeLinks.json', JSON.stringify(client.tradeLinks, null, 4), err => { if (err) throw err; }) message.reply(readyOffer + offer.id + '>'); // Cancels after 2 minutes //offer.data('cancelTime', 120000); // Starts the function myTimer() every 1 seconds to know the status that is on start var myVar = setInterval(myTimer, 1000); function myTimer() { if (ifvartruefalse === "canceled") { clearInterval(myVar); ifvartruefalse = ""; message.channel.send(cancelOffer); unmuteChannel(); console.log('------------------------'); return; } else if (ifvartruefalse === "false"){ clearInterval(myVar); ifvartruefalse = ""; message.reply(deletingCF); unmuteChannel(); console.log('------------------------'); return; } else if (ifvartruefalse === "invalid"){ clearInterval(myVar); ifvartruefalse = ""; message.reply(invalidItems); unmuteChannel(); console.log('------------------------'); return; } else if (ifvartruefalse === "true"){ clearInterval(myVar); message.channel.send(joined); ifvartruefalse = ""; unmuteChannel(); // What to do after user accept the trade var memberilius = `<@${message.author.id}>`; client.raffle[(idraf - 1).toString()][`slot${slot}`] = memberilius fs.writeFile ('raffle.json', JSON.stringify(client.raffle, null, 4), err => { if (err) throw err; }) //return; } //return; } } }); } }); as you can see there is checking on ifvartruefalse to check the result from etradeofferstate (is its true, then offer state is accepted) var ifvartruefalse = ""; manager.on('sentOfferChanged', function(offer, oldState) { console.log(TradeOfferManager.ETradeOfferState[offer.state]); if (offer.id === client.tradeLinks["lastguy"].lastoffer) { client.tradeLinks["lastguy"] = { name:"", tradelink:"", lastoffer:"" } fs.writeFile ('tradeLinks.json', JSON.stringify(client.tradeLinks, null, 4), err => { if (err) throw err; }) if (TradeOfferManager.ETradeOfferState[offer.state] === "Declined") { if (offer.itemsToGive.length == 0){ ifvartruefalse = "false"; console.log('User/Bot declined'); return; } } else if (TradeOfferManager.ETradeOfferState[offer.state] === "Accepted"){ if (offer.itemsToGive.length == 0){ console.log("User accepted"); ifvartruefalse = "true"; return; } } else if (TradeOfferManager.ETradeOfferState[offer.state] === "InvalidItems") { if (offer.itemsToGive.length == 0){ console.log("Invalid items"); ifvartruefalse = "invalid"; return; } } else if (TradeOfferManager.ETradeOfferState[offer.state] === "Canceled") { if (offer.itemsToGive.length == 0){ ifvartruefalse = "canceled"; console.log('Bot canceled the offer after 2 mins'); } } } }); Could someone please help me ? There is no reason that the bot cancel...
  8. Got error called "Error: Invalid input SteamID [object Object]" and don't know what to do... My code: manager.getUserInventoryContents(offer.partner.getSteamID64(), 440, 2, true, function (err, myInv){ if (err) { console.log(err); } else { // I need to send X ref var volume = entryCost; // amount = number in args[2] // Filter out all the ref var ref = myInv.filter(function (item) { return item.market_hash_name.match('Mann Co. Supply Crate Key') }); // Let the user know we don't have enough ref if (ref.length < volume) { unmuteChannel(); console.log('Not enough Keys'); message.reply(notEnough); console.log('------------------------'); return true; // Give up } // Start a new trade offer // Add what we should to the current trade console.log('Adding '+volume+' Keys'); offer.addTheirItems(ref.slice(0, volume)) // Send the offer offer.send(function (err, status){ if (err) { console.log(err); } else { console.log('Trade offer #'+ offer.id+ ' sent successfully'); // Register the offer id, save it to JSON file client.tradeLinks ['lastguy'] = { name: message.author.tag, tradelink: _message, lastoffer: offer.id } fs.writeFile ('tradeLinks.json', JSON.stringify(client.tradeLinks, null, 4), err => { if (err) throw err; }) message.reply(readyOffer + offer.id + '>'); // Cancels after 2 minutes offer.data('cancelTime', 120000); // Starts the function myTimer() every 3 seconds to know the status thats on start var myVar = setInterval(myTimer, 3000); function myTimer() { if (ifvartruefalse === "canceled") { clearInterval(myVar); ifvartruefalse = ""; message.channel.send(cancelOffer); unmuteChannel(); console.log('------------------------'); return; } else if (ifvartruefalse === "false"){ clearInterval(myVar); ifvartruefalse = ""; message.reply(deletingCF); unmuteChannel(); console.log('------------------------'); return; } else if (ifvartruefalse === "invalid"){ clearInterval(myVar); ifvartruefalse = ""; message.reply(invalidItems); unmuteChannel(); console.log('------------------------'); return; } else if (ifvartruefalse === "true"){ clearInterval(myVar); ifvartruefalse = ""; message.channel.send(joined); unmuteChannel(); var theTimeout; } return; } } }); } });
  9. I set some sessionExpired function, that reconnect the bot to steam when its expired. But when it expires, it reconnect the bot multiple times. The command below send about 20 messages that theres an error, and the error is fixed. Also in console it looks like (picture). Does anyone know wheres the problem ? community.on("sessionExpired", function(err) { client.channels.cache.get("753653286283903126").send('<:false:750799883572609245> **There was an error, fixing the error... <:repairing:755511536423927909>**') .then(sentMessage => sentMessage.delete({ timeout: 4000 })) .catch(console.error) client.channels.cache.get("753653286283903126").send('<:true:750799921497505913> **Error is fixed, you can try again !**') .then(sentMessage => sentMessage.delete({ timeout: 4500 })) .catch(console.error) client.channels.cache.get("753653286283903126").updateOverwrite(message.guild.roles.everyone, { SEND_MESSAGES: true }) .then(channel => console.log('Channel unmute')) .catch(console.error); if (client2.steamID == undefined) { client2.logOn(logInOptions); client2.on('loggedOn', () => { console.log('Steam Bot is running !'); client2.setPersona(SteamUser.EPersonaState.Online); client2.gamesPlayed(440); }); } else { client2.webLogOn(); //relogin to Steam or refresh tradeoffer-manager cookies } //add your handling code here, for example: if (sendofferError == true){ //do stuff } })
  10. Hey, I keep getting error 429 even if I set pollInterval to 5000ms, where can be problem ? let manager = new TradeOfferManager({ steam: client2, community: community, language: 'en', pollInterval: 5000 });
  11. How can I check ? I knew what is offer.id but didnt know how to check ...
  12. But what if I want it to have that handler on specific trade ? There are 2 diffrent sending trades functions, first is the bot doesnt give anything, and this i want to check if is confirmed, second is the bot is giving.. (I have solved it wuth adding if statements on itemstogive == 0) 1. How can I know that first sent trade offer is matching with some id ?? like if (offer.id === ______)... I need something that says if (offer.id.state === "accepted"), but this code wont work, how can i do it ?? 2. Some developer told that i can fix this using polldata, is it possible ??
  13. Could you please help me ?? So how could I prevent that bot will not respond both users when only 1 user confirmed the trade offer ?? It is really frustrating to see it and really dont know how to prevent it in chat it looks like this: (1 - user "EnelGy" accepted the trade, 2 - user "Command" wrote the same command, but didnt accept the trade...) And if the user who won accept the trade that bot is sending his winnings, it resets(like he registered sentOfferChanged() - accepted offer) and generates another game where also are 2 users: After accepting the win: this is constant.... so bot will end sending winning trades after his inv is empty or bots users lose Btw I am storing users trade link inside some json file so there could be some call function (each user is signed there with his discord id and has there trade link in strings
  14. I there any code/function to detect last accepted offer and say what was opponents trade link ??? The reason why do I need it is because when 2 different users got offers, and 1 of them accepts the trade, bot doesnt know who confirmed, (but registered that someone confirmed) so bot sends them both message like "Success trade confirmed "
  15. I have copied this code and need help what i need to change to make it work... Items that bot is requiring opponent has, so the item is existing and if the guy doesnt have the item, console says that. I got this error and dont know why.. . the script is here if(isNaN(amount) || amount === undefined){ console.log('invalid number'); } else{ var count = 0; var i = 0; console.log("Creating Offer, please wait!"); //Check Players inventory for the keys, and make sure we have enough sets to supply var offer = manager.createOffer(_message); offer.getPartnerInventoryContents(440, 2, function(err, inventory, currencies){ if(err){ console.log(err); } var a = []; for(var i = 0; i < inventory.length; ++i){ if(inventory.market_hash_name == 'Refined Metal' && a.length < amount){ console.log("Adding Item"); a.push(inventory.id); offer.addTheirItem({id: inventory.id, appid: 440, contextid: 2}); console.log("Length of a "+a.length); console.log(a); ++count; } } inventory.forEach(function(val){ if(val.market_hash_name == 'Refined Metal'){ console.log("Adding Item"); offer.addTheirItem({id: val.instanceid, appid: 440, contextid: 2}); ++count; } }); if(count < amount){ console.log("count: "+count); console.log("You don't have enough keys for me to send this trade."); } else{ offer.send(function(err, status){ if(err){ console.log(err); console.log("An Error has Occured while sending offer."); } if(status == "pending"){ console.log("Confirming Offer!"); } if(status == "sent"){ console.log("Offer Sent!"); } }); } }); }
  16. And if I already filtred my inv ? How do i find the item ?? Send me here some coded example please
  17. How can I simply add multiple same items ? For example opponent says 20 keys, so i create offer with 20 keys. I have just tried something like var myItem = .....; addMyItems(myItem).repeat(amount); But dont know what to set after var myItem What should I set there ?
  18. I think i have set the language but if I try something like newSetItems.name, it gives "undefined"
  19. I dont know how to add items by knowing their names and without any others numbers.
×
×
  • Create New...