Jump to content
McKay Development

All Activity

This stream auto-updates

  1. Past hour
  2. Yesterday
  3. Is anyone able to let me know how i'd be able to do this? I have not found anything that would help me
  4. Last week
  5. yep, that works, thanks for a fast reply!
  6. You must use EAuthTokenPlatformType.SteamClient to get a token that's eligible for use with steam-user.
  7. Hi! I'm getting refreshToken via your new steam-session module (startWithCredentials). After a succesful logon I'm passing the refreshToken as a parameter to steam-user module to logOn method. But I am getting an error: C:\Users\Administrator\desktop\test\node_modules\steam-user\components\08-logon.js:133 let err = new Error('This refreshToken is not valid for logging in to the Steam client'); ^ Error: This refreshToken is not valid for logging in to the Steam client at C:\Users\Administrator\desktop\test\node_modules\steam-user\components\08-logon.js:133:16 at processTicksAndRejections (node:internal/process/task_queues:78:11) { tokenAudiences: [ 'web', 'renew', 'derive' ] } There is getting refreshToken module: import {EAuthTokenPlatformType, LoginSession} from 'steam-session'; import choseAccount from "../functions/choseAccount.js"; import SteamTotp from "steam-totp"; import {setupSteam} from "./setupSteam.js"; let accountData = choseAccount(); export let steamLoginData; export async function createSession() { let session = new LoginSession(EAuthTokenPlatformType.WebBrowser); await session.startWithCredentials({ accountName: accountData.account_name, password: accountData.password, steamGuardCode: SteamTotp.getAuthCode(accountData.shared_secret) }); session.on('authenticated', async () => { console.log(`Logged into Steam as ${session.accountName}`); let webCookies = await session.getWebCookies(); if (webCookies) { steamLoginData = { accessToken: session.accessToken, refreshToken: session.refreshToken, webCookies: webCookies } await setupSteam(steamLoginData) } }); session.on('timeout', () => { console.log('This login attempt has timed out.'); }); session.on('error', (err) => { console.log(`ERROR: This login attempt has failed! ${err.message}`); }); } And main part of another module: import SteamCommunity from 'steamcommunity'; import SteamUser from 'steam-user'; import timeout from "../functions/timeout.js"; import TradeOfferManager from 'steam-tradeoffer-manager'; import {sendMessage} from "../functions/sendMessage.js"; import fs from 'fs'; let client = new SteamUser(); let community = new SteamCommunity(); let manager = new TradeOfferManager({ 'steam': client, 'community': community, "domain": "local.com", "language": "en", "pollInterval": 20000 }); export async function setupSteam(loginData) { client.logOn({"refreshToken": loginData.refreshToken}) client.on('loggedOn', async function () { console.log("Logged into Steam as " + client.steamID.getSteamID64()); client.setPersona(SteamUser.EPersonaState.Online); await launchGame(440) }) client.on('error', async function (err) { console.log(err) }) } I'm using latest versions of modules: "steam-user": "^4.25.0", "steam-session": "^0.0.2-alpha"
  8. In my case it works like this. Maybe this will help you. // lodash // cards = { "<appid>": ["<classid>": [ {<item>}, ... ], ... ], ... } // cardData = {"220":{"amount":8,"name":"Half-Life 2"} ... } function getSets(cards, callback) { let cardSets = {} let extraCards = [] let unknownCards = [] lodash.forOwn(cards, (cards, id) => { id = id.toString() if (cardData[id]) { let cardCount = lodash.mapValues(cards, array => array.length) cardCount = Object.keys(cardCount).map(number => cardCount[number]) let min = Math.min(...cardCount) let max = Math.max(...cardCount) // There is at least one full set. if (Object.keys(cards).length == cardData[id].amount) { cardSets[id] = [] for (let i = 0; i < min; i++) { let set = [] lodash.forOwn(cards, item => { set.push(item[i]) }) cardSets[id].push(set) } // There are no full sets. } else { min = 0 } // Extra cards: for (let i = min; i < max; i++) { lodash.forOwn(cards, item => { if (item[i]) { extraCards.push(item[i]) } }) } // Unknown cards: } else { lodash.forOwn(cards, item => { unknownCards.push(item) }) } }) callback(cardSets, extraCards, unknownCards) }
  9. The language is not the problem here, I receive the offer, i check the offer details, then filter items for trading cards only, after that i have a database of {appid, number of cards in set} which i need to compare against it and retrun the amount of sets Im lacking the idea of how to process it!
  10. If I remember correctly, you can specify language in Options ( https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOfferManager#language ) In this case, you will receive all data like name and tags. This can take up a lot of memory. (in my case, this required several gigabytes with a large number of trading offers / items in offers) If language disabled, you can check only classid. I don't know of any database that gives any additional information by classid.
  11. Hi, How would you check sets in the incoming trade offers which contains random cards? There is already a database that is used by level up bots to define how much card in the set of game.
  12. That will log the IDs of the items before they were traded. To get new asset IDs, use the getExchangeDetails method on the TradeOffer object.
  13. I don't think skins and floats are possible to see on private profiles but what I can see is medals pins and coins. You can see all medals as possible including pro players trophy's. so yeah
  14. manager.on('sentOfferChanged', function(offer, oldState){console.log(offer)}) When a trade has been accepted, will the code above log the assetid of the items before they were traded, or will it log the changed assetids of the items after they were traded? Thanks for any help.
  15. Earlier
  16. Hello, can someone help me i get same error after 100 seconds of running /app/node_modules/steam-user/components/logon.js:10 Thank you
  17. 1. I am using the latest version of "steam-user", 4.25.0 2. Yes, this is a better implementation, thank you 3. Tried to do this, but now every time at the first run of checkOnline() instead of nonexisting data I receive timeouts, one per every receiver, at the second run everything is fine again. So, I guess, I`ll stuck with setTimeout(). Example of code: client.on('loggedOn', function () { console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID()); client.setPersona(SteamUser.EPersonaState.Online) client.on('user', function (sid, user) { // should be enough because Steam emits it only if this client instance's persona state is online if (Object.values(user).includes('link-to-bot-profile-picture.jpg')) { checkOnline() } }) }); Example of timeout: Error: Request timed out at Timeout._onTimeout (C:\Users\Andrew\WebstormProjects\Notif-steam-bot\node_modules\@doctormckay\stdlib\components\promises.js:17:12) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7)
  18. Sounds like you might not be up to date. I'd fetch all rows upfront, then request all personas at the same time. Seems good, I think Steam might send you a persona update via the user event for yourself when you set yourself to online; if it does, then waiting to see yourself as online might be all you need.
  19. 1. That`s the funny thing, I don`t understand why, but when personas is before err, it is just logging into console all the data instead of errors, like: { '22222222222222222': { rich_presence: [], persona_state: 3, game_played_app_id: 0, ...etc } } The only way it works correctly in this order is like this, the problem still persists : client.getPersonas([receivers[i]], function (personas, err) { if (personas) { console.log(personas) } else { let data = err[receivers[i]].persona_state 2. Actually in the real code I am fetching data row by row from sqlite database, checking for each row a column wasMessagedToday, if it is false, then calling getPersonas() and if messaged successfully, updating wasMessagedToday value in database to true. Maybe there is a better way, but I am an absolute newbie in database stuff. 3. Thank you, thank you!!! I`ve tried already few ways to delay time including setTimeout(checkOnline, 2000) after setting persona to Online, but it wasn`t working. Tried now to increase the delay to 10 seconds and now data from getPersonas() is correct at every run! I guess Steam is really slow with status updates. So the fix looks like this: client.on('loggedOn', function () { console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID()); client.setPersona(SteamUser.EPersonaState.Online) setTimeout(checkOnline, 10000); });
  20. The order of parameters to the getPersonas callback is err, personas. You have it backwards. The getPersonas function accepts multiple IDs. Why are you calling it individually for each ID? You might need to delay some time after calling setPersona to set yourself online, as you're currently sending the getPersonas requests synchronously at the same time as setPersona, without giving Steam enough time to process that you're now online.
  21. I am trying to create a program, which every specified ammount of time sends a message to my steam friends, if conditions are met. The thing is that I call messaging function after setting bot status to Online, but at the first run client.getPersonas() returns all the users data, like the bot`s persona is offline (most parameters are null or 0). Everything works fine at second and subsequent runs of checkOnline(). Please, I am almost sure this is because of some stupid mistake, but I cannot find this mistake for two days already. Please tell me, where I messed up. Simplified code below. steam-user v4.25.0 import SteamUser from "steam-user"; import SteamTotp from "steam-totp"; const receivers = [ '11111111111111111', //IDs for example '22222222222222222', ] function main() { const client = new SteamUser(); function steamLogin() { client.logOn({ "accountName": process.env.accountName, "password": process.env.password, twoFactorCode: SteamTotp.generateAuthCode(process.env.twoFactorCode) }); client.on('loggedOn', function () { console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID()); client.setPersona(SteamUser.EPersonaState.Online) checkOnline() //calling the second function }); } function checkOnline() { for (let i = 0; i < receivers.length; i++) { client.getPersonas([receivers[i]], function (personas, err) { if (err) { console.log(err) } else { let data = personas[receivers[i]].persona_state if (data === 1 || data === 2 || data === 3) { client.chat.sendFriendMessage(receivers[i], `It works!`); console.log('Message sent!', receivers[i]) } } }) } setTimeout(checkOnline, 10000); } steamLogin() } main()
  22. That's correct, if you want newOffer to be emitted again the next time the bot starts up, you'd want to make sure you don't save poll data.
  23. It looks like in order to fix this problem, you just need to set polldata.json to {} - so I guess the purpose of that file was to avoid doing exactly the thing I wanted to do? Kind of ironic, but different people code in different ways!
  24. It looks like the "new offer" event doesn't fire for pending offers when the bot starts up. How can I ensure that all of those are processed when the bot starts up? I have noticed that the script creates a polldata.json file, but despite this, it never fires the trade offers while the bot is down. I guess this is to avoid duplicate trade offer processing, but this could be avoided by just not processsing them before it shuts down. So, does anyone know how to handle something like this?
  25. I'm assuming that this log output is produced by multiple steam-user instances, since there shouldn't be any situation where multiple connections belonging to the same SteamUser instance would be open. If this isn't the case, there's a bug. In your screenshot, it does look like T1 and T2 are still connected. I don't honestly know what circumstance would cause the AlreadyLoggedInElsewhere error; normally if you log into an account that's already logged on elsewhere, it'll still work. If there's a logon ID conflict, the first session would get booted with LoggedInElsewhere (eresult 6, separate from AlreadyLoggedInElsewhere).
  26. https://github.com/DoctorMcKay/node-steam-user#steamguard
  1. Load more activity
×
×
  • Create New...