TextDynasty
-
Posts
144 -
Joined
-
Last visited
Posts posted by TextDynasty
-
-
Hi, so I wrote a few codes to my bot to make it send me a message with offer id included once there's a need for the background check. But I don't know how or is there a way to make it accept the trade offer through providing the trade offer id to the bot.
const parseAdminMessage = (message) =>{ if (message.substring(0,8) == '!accept '){ var offerid = message.substring(8); console.log(offerid); //It can show the correct offerid here but i dont know how to make it accept the trade by the offerid } //This is what I used to accept normal trade offer with the offer status const acceptTradeOffer = (offer) => { offer.accept(false, function(error, status) { if (error) { logger.error(`| OFFER RECEIVED |: ID#${offer.id} has failed trying to accept it. Reason: Offer is no longer valid.`); return 'Badass'; } else if (status === 'pending') { logger.info(`| OFFER NEEDS CONFIRM | : ID#${offer.id} is accepted but needs confirmation`); var confCount = 0; function confirm(idSecret, idOffer) { community.acceptConfirmationForObject(idSecret, idOffer, function(error) { confCount++ if (error) { if (confCount < 4) { confirm(idSecret, idOffer); } else { logger.error(error); logger.fail(`| OFFER RECEIVED | : ID#${offer.id} has failed trying to confirm it. Reason: Offer is no longer valid.`); return 'done'; } } else { return 'done'; } }); } confirm(config.identity_secret, offer.id); } else { return 'done'; } }); }
-
Is there any open source code for deleting the crates automatically?
-
I was expecting using ingame currencies
-
Oh i think it is not suitable for tf2 trading
-
That would be great if you could provide help
-
Is there a way to set a variable of the price by using this package?
https://github.com/tarikkiziltan/getPrice
I saw there's
var Price = require("./getprice.js") //var price = new Price(tag,craft,item,callBack) // What should i put in the callback if i want to use the price? Thanks Price.getPrice("Vintage","Craftable","Gunslinger",function(price,priceType) { console.log("It's " + price + " " + priceType); })
-
-
It happens everytime i test it, doesn't seems to be steam problem?
-
How can i use the bp.tf api to get my listing price and community price
-
Need Some Help with the problem
{ Error: The request is a duplicate and the action has already occurred in the past, ignored this time
The Code i am using
function craftScrap(){ manager.getInventoryContents(440, 2, true, function (err, inventory){ if (err) { console.log(err); } else { var rec = inventory.filter(function (item) { return item.name == "Reclaimed Metal" }); var ref = inventory.filter(function (item) { return item.name == "Refined Metal" }); var recCount = rec.length; var refCount = ref.length; if (recCount || refCount > 0){ console.log("User can smelt metals"); if(recCount == 0){ for (let i = 0; i < refCount; i++) { tf2.craft([ref[i].id]); } manager.getInventoryContents(440, 2, true, function (err, inventory){ var rec1 = inventory.filter(function (item) { return item.name == "Reclaimed Metal" }); var rec1Count = rec1.length; for (let i = 0; i < rec1Count; i++) { tf2.craft([rec1[i].id]); } }) } else { for (let i = 0; i < recCount; i++) { tf2.craft([rec[i].id]); } } } else { console.log("No metal to smelt"); return; } } }) }
-
https://github.com/xLeeJYx/TF2-Crafting-Recipe/blob/master/craftRecipe.json
Follow that, and btw you have to craft scrap to reclaimed, then reclaimed to refined. You cant go x9 scrap immediately to refined
Thanks for the recipe, but i still cannot figure out how to put them all together like McKay said.
-
Thanks
-
//Error
Friend message from admin: !ref 3
USER WANT REF
{ Error: The request is a duplicate and the action has already occurred in the past, ignored this time -
-
You need to pass
craft
an array of item IDs you want to craft together. Right now you're just passing in one metal per craft, so it's smelting the metal down because that's all it can do with one metal.How can i put them together?
console.log("NO REF"); for (let i = 0; i < scrap.length; i++) { var array = [scrap.id, scrap.id, scrap.id] tf2.craft(array); }
-
I have a question about where should i put my crafting recipe in the code
My code
//Show Online client.on('loggedOn', function (details) { console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID()); client.setPersona(1); }); //crafting tf2.on("backpackLoaded", function(craft) { manager.getInventoryContents(440, 2, true, function (err, inventory){ if (err) { console.log(err); } else { var scrap = inventory.filter(function (item) { return item.name == "Scrap Metal" }); var reclaimed = inventory.filter(function (item) { return item.name == "Reclaimed Metal" }); var refined = inventory.filter(function (item) { return item.name == "Refined Metal" }); if (refined.length < 1){ console.log("NO REF"); for (let i = 0; i < reclaimed.length; i++) { tf2.craft([reclaimed[i].id]); //where should i put my recipe in? } } } }); })
https://dev.doctormckay.com/topic/1416-tf2-crafting-recipe/?hl=recipe
I tried this code, yes it crafted me some metals, but i want refined metal while it gave me scrap from reclaimed metals. So how can i change my recipe in order to get what i needed?
Btw Happy New Year McKay
-
Sorry i don't understand how to use it. Is there any examples in Github or somewhere?
-
Thanks, also is there a way to get the profile name of someone using steamID?
-
You need quotes around it. It's a string.
Quote the whole thing like this give error
Unknown SteamID input format "g:1:26823824"
client.inviteToGroup(steamID, ["g:1:26823824"]);
And Quote the id like this
client.inviteToGroup(steamID, [g:1:"26823824"]);
doesnt work too
-
You can use either the 64-bit one or the ID in the edit page, if you put the edit page ID into this formula:
[g:1:id]
For example
[g:1:4]
-> https://steamcommunity.com/gid/[g:1:4]Hmm I followed that but this error happens
client.inviteToGroup(steamID, [g:1:26823824]); Unexpected token :
-
Problem solved
-
ERROR
"uri": "https://steamcommunity.com/inventory/" + userID. getSteamID64() + "/" + appID + "/" + contextID, ^ TypeError: Cannot read property 'getSteamID64' of null
My code
function sendRec(steamID, amount){ if (!amount) { var amount = 1; } if (amount == 0) { console.log("User didn't provide a correct amount!"); return; } manager.getUserInventoryContents(steamID, 440, 2, true, function (err, inventory){ if (err) { console.log(err); } else { var scrap = inventory.filter(function (item) { return item.name == "Scrap Metal" }); var refined = inventory.filter(function (item) { return item.name == "Refined Metal" }); var NeededS = amount * 3 var NeededR = amount / 3 if (scrap.length === 0 && refined.length === 0){ client.chatMessage(steamID, "It seems you don't have enough scrap."); return; } else if (amount > NeededS && amount > NeededR) { client.chatMessage(steamID, "You don't have enough scrap. You'll need " + left + " more scrap metals."); return; } else if (amount <= NeededS || amount <= NeededR) { manager.getInventoryContents(440, 2, true, function (err, inventory){ if (err) { console.log(err); } else { var pool = inventory.filter(function (item) { return item.name == "Reclaimed Metal" }); // Let the user know we don't have any if (pool.length === 0) { client.chatMessage(steamID, "I don't have available. Sorry!"); return; } else if (amount > pool.length) { console.log("User asked for more than my backpack."); client.chatMessage(steamID, "I only have " + pool.length + " available. Sorry!"); return; } else if (amount <= pool.length) { // Start a new trade offer var trade = manager.createOffer(steamID); // Add what we should to the current trade console.log("Adding " + amount + " rec."); if (scrap.length < NeededS) { if (Number.isInteger(NeededR) == false){ return; } else { console.log("User doesn't have enough scrap. Sending REF OFFER!!"); //USER ITEMS for (let i = 0; i < NeededR; i++) { trade.addTheirItem(refined[i]); } //BOT ITEMS for (let i = 0; i < amount; i++) { trade.addMyItem(pool[i]); } } } else { console.log("User have enough scrap. Sending SCRAP OFFER!!"); //USER ITEMS for (let i = 0; i < NeededS; i++) { trade.addTheirItem(scrap[i]); } //BOT ITEMS for (let i = 0; i < amount; i++) { trade.addMyItem(pool[i]); } } trade.setMessage("Here is your " + amount + " reclaimed metals"); trade.send(function(err, status) { if (err) { console.log(err); return; } else if (status == 'pending') { console.log("Offer " + trade.id + "have been sent."); community.startConfirmationChecker(15 * 1000, config.identity); client.chatMessage(steamID, "Processing."); client.chatMessage(steamID, "Offer Sent!! Check your trade offer by here https://steamcommunity.com/tradeoffer/" + trade.id + "/."); } }); } } }); } } }) }
-
What is the group steam id in the inviteToGroup
https://github.com/DoctorMcKay/node-steam-user#invitetogroupusersteamid-groupsteamid
There is two ID, the 64 ones and the id obtain by steam group edit page.
What should i put in there??
EDIT 1: Also is there a way to get the profile name of someone using steamID?
-
Found the problem Thanks McKay
Is there a way to accept a certain trade offer through message with its offerid?
in node-steam-tradeoffer-manager
Posted · Edited by TextDynasty
Is this what you mean by getOffer?
It has this error