help icon indicating copy to clipboard operation
help copied to clipboard

Creating bot on steam

Open CutteLighty opened this issue 8 years ago • 10 comments

  • Node.js Version: 8.11.2 LTS
  • OS: Windows
  • Scope (install, code, runtime, meta, other?):
  • Module (and version) (if relevant):
const SteamUser = require ('steam-user');
const config = require('./config.json');
const client = new SteamUser();

const LogOnOptions = {
    accountname: config.username,
    password: config.password
};

client.LogOn(LogOnOptions);

client.on('LoggedOn', () => {
    console.log('succesfully logged on.');
});

--> SyntaxError: C:\Users\Unistar\Desktop\Bots\Bot 1\config.json: Unexpected token } in JSON at position 63 at JSON.parse () at Object.Module._extensions..json (module.js:671:27) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (C:\Users\Unistar\Desktop\Bots\Bot 1\bot.js:2:16) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10)

CutteLighty avatar Jun 12 '18 20:06 CutteLighty

It would be helpful to see the content of the config.json.

vsemozhetbyt avatar Jun 12 '18 21:06 vsemozhetbyt

{ "username":"Actual name", "password":"Actual password", }

CutteLighty avatar Jun 12 '18 21:06 CutteLighty

If I understand correctly, the issue is the trailing comma: JSON does not support them.

vsemozhetbyt avatar Jun 12 '18 21:06 vsemozhetbyt

Removed them no difference still the same problem.

CutteLighty avatar Jun 12 '18 21:06 CutteLighty

Do you get exactly the same error message with this json?

{
"username":"Actual name",
"password":"Actual password"
}

vsemozhetbyt avatar Jun 12 '18 21:06 vsemozhetbyt

I mean, only the last comma was removed, right?

vsemozhetbyt avatar Jun 12 '18 21:06 vsemozhetbyt

now its C:\Users\Unistar\Desktop\Bots\Bot 1>node bot.js C:\Users\Unistar\Desktop\Bots\Bot 1\bot.js:10 client.LogOn(LogOnOptions); ^

TypeError: client.LogOn is not a function at Object. (C:\Users\Unistar\Desktop\Bots\Bot 1\bot.js:10:8) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:612:3

CutteLighty avatar Jun 12 '18 21:06 CutteLighty

It seems this new error is better to be posted in https://github.com/DoctorMcKay/node-steam-user

vsemozhetbyt avatar Jun 12 '18 21:06 vsemozhetbyt

A check on the defined API suggests the problem is the capitalisation of the method name. Its logOn() not LogOn().

shellberg avatar Jun 13 '18 12:06 shellberg

Solved by Shellberg

CutteLighty avatar Jun 13 '18 12:06 CutteLighty