Jump to content
McKay Development

mxnster

Member
  • Posts

    11
  • Joined

  • Last visited

Posts posted by mxnster

  1. Is there any way to identify items bought from market?

    The only idea i have its to get float from inspect link (using fload and etc) and compare, but it won't work for all games and skins.

    Object of purchased item from market history:

    {
       "currency":0,
       "appid":730,
       "contextid":"2",
       "id":"33653384162",
       "classid":"310776580",
       "instanceid":"302028390",
       "amount":"0",
       "status":4,
       "original_amount":"1",
       "unowned_id":"33653384162",
       "unowned_contextid":"2",
       "background_color":"",
       "icon_url":"-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgposem2LFZfwOP3ZTxS6eOlnI-Zg8j-JrXWmm5u5cB1g_zMu46m3Qy2-RBqYG-lIY6SdVI7ZVHT-la8xuvn0MPttJSby3pqvyIg5XfD30vgSYELDI8",
       "icon_url_large":"-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgposem2LFZfwOP3ZTxS6eOlnI-Zg8j-JrXWmm5u5cB1g_zMyoD0mlOx5RFvZmGhJtWTcQBoZFDX_QW7xefshZG-u5jBnCcysilw53fUmhe1gRBSLrs4jIQo_Mo",
       "descriptions":[//useless],
       "tradable":1,
       "actions":[
          {
             "link":"steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M4386002591429815349A%assetid%D6926549612778658941",
             "name":"Inspect in Game..."
          }
       ],
       "name":"G3SG1 | Jungle Dashed",
       "name_color":"D2D2D2",
       "type":"Consumer Grade Sniper Rifle",
       "market_name":"G3SG1 | Jungle Dashed (Field-Tested)",
       "market_hash_name":"G3SG1 | Jungle Dashed (Field-Tested)",
       "market_actions":[
          {
             "link":"steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M4386002591429815349A%assetid%D6926549612778658941",
             "name":"Inspect in Game..."
          }
       ],
       "commodity":0,
       "market_tradable_restriction":7,
       "marketable":1,
       "app_icon":"https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/apps/730/8dbc71957312bbd3baea65848b545be9eae2a355.jpg",
       "owner":0
    }

    Object of the same item from inventory (assets+description):

    {
       "appid":730,
       "contextid":"2",
       "assetid":"34322508958",
       "classid":"5600182583",
       "instanceid":"302028390",
       "amount":"1",
       "currency":0,
       "background_color":"",
       "icon_url":"-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgposem2LFZfwOP3ZTxS6eOlnI-Zg8j-JrXWmm5u5cB1g_zMu46m3Qy2-RBqYG-lIY6SdVI7ZVHT-la8xuvn0MPttJSby3pqvyIg5XfD30vgSYELDI8",
       "icon_url_large":"-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgposem2LFZfwOP3ZTxS6eOlnI-Zg8j-JrXWmm5u5cB1g_zMyoD0mlOx5RFvZmGhJtWTcQBoZFDX_QW7xefshZG-u5jBnCcysilw53fUmhe1gRBSLrs4jIQo_Mo",
       "descriptions":[//useless],
       "tradable":0,
       "actions":[
          {
             "link":"steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S%owner_steamid%A%assetid%D16143722884360181335",
             "name":"Inspect in Game..."
          }
       ],
       "owner_descriptions":[
          {
             "type":"html",
             "value":" "
          },
          {
             "type":"html",
             "value":"Tradable After Nov 08, 2023 (8:00:00) GMT",
             "color":"ff4040"
          }
       ],
       "name":"G3SG1 | Jungle Dashed",
       "name_color":"D2D2D2",
       "type":"Consumer Grade Sniper Rifle",
       "market_name":"G3SG1 | Jungle Dashed (Field-Tested)",
       "market_hash_name":"G3SG1 | Jungle Dashed (Field-Tested)",
       "market_actions":[
          {
             "link":"steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M%listingid%A%assetid%D16143722884360181335",
             "name":"Inspect in Game..."
          }
       ],
       "commodity":0,
       "market_tradable_restriction":7,
       "marketable":1,
       "tags":[//useless]
    }
  2. On 10/27/2023 at 9:07 AM, Dr. McKay said:

    I believe I found the bug. Run npm update again and make sure that you end up with steam-session 1.7.1 or later.

    On Linux, you can do npm ls -a | grep steam-session to check your steam-session version.

    Hello! Seems like everything is fine right now. Thanks!

  3. 3 hours ago, Dr. McKay said:

    5.0.2 is up. I don't really expect it to change things, but it might. I did double-check and steam-user is still doing exactly the same thing the client is for getting a web session.

    Thank you, I updated to the latest versions. Usually this error appears a couple of days after launch. I'll report the results.

  4. Hi!

    I have problems with seesions since last updates.

    Providing some important parts of my code:

    Creatin session using steam-session v1.6.0:

    async function getSession() {
        return new Promise(async (resolve, reject) => {
            let session = new LoginSession(EAuthTokenPlatformType.SteamClient);
     
            session.on('authenticated', async () => {
                try {
                    console.log(`Getting session as ${session.accountName}`);
                    let webCookies = await session.getWebCookies()
     
                    if (webCookies) {
                        steamLoginData = {
                            accessToken: session.accessToken,
                            refreshToken: session.refreshToken,
                            webCookies: webCookies
                        }
                        resolve(steamLoginData)
                    }
                } catch (ex) {
                    reject(ex);
                }
            });
     
            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}`);
            });
     
            try {
                await session.startWithCredentials({
                    accountName: config.username,
                    password: config.password,
                    steamGuardCode: SteamTotp.getAuthCode(config.ss)
                })
            } catch (ex) {
                return reject(ex);
            }
        })
    }

    Creating instanses:

    let client = new SteamUser();
    let community = new SteamCommunity(); // latest version
    let manager = new TradeOfferManager({  // latest version
        'steam': client,
        'community': community,
        "domain": "example.com"
        "language": "en"
        "pollInterval": 10000
    });

    Then logging in using steam-user v5.0.1:

        client.logOn({ "refreshToken": steamLoginData.refreshToken })
     

    Handling events:

    client.on('loggedOn', function () {
        console.log("Logged into Steam as " + client.steamID.getSteamID64());
    });
    client.on('webSession', function (sessionID, cookies) {
        manager.setCookies(cookies, function (err) {
            if (err) {
                console.log(err);
                process.exit(1);
                return;
            }
        });
     
        community.setCookies(cookies);
    });
    community.on('sessionExpired', async function (err) {
        if (err) {
            console.log('Session Expired: ' + err);
        }
     
        if (client.steamID) {
            client.webLogOn();
            console.log('called weblogon: ' + client.steamID);
        } else {
            await clientlogin()
            console.log('called logon');
        }
    });
     
    async function clientlogin() {
        await getSession();
        client.logOn({ "refreshToken": steamLoginData.refreshToken })
        await timeout(5000)
    }

    Logs after some time:

    [04:56:56] Trade offer #6477610753 from *** confirmed
    [10:27:18] Session Expired: Error: HTTP error 403
    [10:27:18] called weblogon: 7656*************
    [10:27:18] Unable to accept offer: Not Logged In
    [11:48:34] Session Expired: Error: HTTP error 403
    [11:48:34] called weblogon: 7656*************
    [11:48:34] Unable to accept offer: Not Logged In
    [11:53:06] Session Expired: Error: HTTP error 403
    [11:53:06] called weblogon:7656*************
    [11:53:06] Unable to accept offer: Not Logged In
    [11:54:54] Session Expired: Error: HTTP error 403
    [11:54:54] called weblogon:7656************

    webLogOn() doesn't seem to work.

    Any ideas where I'm wrong? How to correctly handle an event sessionExpired? This code worked fine, but after the latest updates to the latest versions it no longer works.

     
  5. 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"
  6. Hello!

    I have problems with login.

    const SteamUser = require('steam-user');
    const SteamTotp = require('steam-totp');
    const config = require('./config');
     
    const client = new SteamUser();
     
    const logOnOptions = {
        "accountName": config.username,
        "password": config.password,
        "twoFactorCode": SteamTotp.getAuthCode(config.ss)
    }
     
    client.logOn(logOnOptions);
     
    client.on('loggedOn', () => {
        console.log('logged');
    });
     
    internal/fs/utils.js:779

      throw new ERR_INVALID_ARG_TYPE(
      ^

    TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (165)
        at Object.writeFile (fs.js:1436:5)
        at FileStorage.saveFile.FileStorage.writeFile (C:\Users\ronal\Desktop\steam-auto-confirm-accept\node_modules\file-manager\index.js:68:5)
        at SteamUser._handlers.<computed> (C:\Users\ronal\Desktop\steam-auto-confirm-accept\node_modules\steam-user\components\logon.js:294:18)
        at SteamUser._handleMessage (C:\Users\ronal\Desktop\steam-auto-confirm-accept\node_modules\steam-user\components\messages.js:249:30)
        at CMClient.emit (events.js:315:20)
        at CMClient._netMsgReceived (C:\Users\ronal\Desktop\steam-auto-confirm-accept\node_modules\steam-client\lib\cm_client.js:323:8)
        at CMClient.handlers.<computed> (C:\Users\ronal\Desktop\steam-auto-confirm-accept\node_modules\steam-client\lib\cm_client.js:609:8)
        at CMClient._netMsgReceived (C:\Users\ronal\Desktop\steam-auto-confirm-accept\node_modules\steam-client\lib\cm_client.js:305:24)
        at TCPConnection.emit (events.js:315:20)
        at TCPConnection._readPacket (C:\Users\ronal\Desktop\steam-auto-confirm-accept\node_modules\steam-client\lib\tcp_connection.js:183:7) {
      code: 'ERR_INVALID_ARG_TYPE'
    }

×
×
  • Create New...