简体   繁体   English

Node.js Steam 交易机器人

[英]Node.js steam trade bot

So I'm trying to code with node.js for the first time, and have very small prior coding knowledge.所以我第一次尝试使用 node.js 进行编码,并且具有非常少的先验编码知识。 I'm trying to code a steam trading bot, but I'm already stumped at the basics of it.我正在尝试编写一个 Steam 交易机器人,但我已经被它的基础知识难住了。 This is the code I have, titled "bot.js":这是我的代码,标题为“bot.js”:

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

const logOnOptions = {
    accountName: config.username,
    password: config.password
};

client.logOn(logOnOptions);

client.on('loggedOn', () => {
console.log('Succesfully logged on.');
});

In the config.json file I just have the username and password which are fine.在 config.json 文件中,我只有用户名和密码,这很好。 My problem is that when typing in node bot.js after installing steam-user, I get this error:我的问题是,在安装 steam-user 后输入 node bot.js 时,出现此错误:

module.js:471
throw err;
^

Error: Cannot find module 'C:\Users\Name\Desktop\bot\bot.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3

Help?帮助?

This is not an error with your code, but an error node is throwing saying it can't find bot.js in your directory C:\\Users\\Name\\Desktop\\bot这不是您的代码错误,而是一个错误节点抛出说它在您的目录C:\\Users\\Name\\Desktop\\bot找不到bot.js

Verify that that is the directory where bot.js lives and that the file name is indeed bot.js .验证这是bot.js所在的目录,并且文件名确实是bot.js Also make sure there are no hidden extensions, the file could possibly be bot.js.txt .还要确保没有隐藏的扩展名,文件可能是bot.js.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM