0

Im trying to make a steam trade bot, but when I try to run it, it says "SyntaxError: Unexpected identifier"

const SteamUser = require('steam-user');
const client = new SteamUser();
const config = require('./config.json');

client.logOn({
  accountName: config.username,
  password: config.password,
  var SteamTotp = require('steam-totp');
  var code = SteamTotp.generateAuthCode('cnOgv/KdpLoP6Nbh0GMkXkPXALQ=');
});

client.on('loggedOn', () => {
  console.log('Logged into Steam!');

  client.setPersona(SteamUser.Steam.EPersonaState.Online);
});
  • 2
    Check this : https://stackoverflow.com/questions/68044491/error-invalid-shorthand-property-initializer-in-javascript/68044535?noredirect=1#comment120266597_68044535. You cannot use `=` inside object literals as you are doing in client.logOn(). – Tushar Shahi Jun 19 '21 at 07:49

1 Answers1

0

Can you please try this code

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp')
const client = new SteamUser();
const config = require('./config.json');

client.logOn({
    accountName: config.username,
    password: config.password,
    SteamTotp,
    code:SteamTotp.generateAuthCode('cnOgv/KdpLoP6Nbh0GMkXkPXALQ=')
});

client.on('loggedOn', () => {
    console.log('Logged into Steam!');

    client.setPersona(SteamUser.Steam.EPersonaState.Online);
});