Thank you very much for your reply, but I'm still confused because I'm really new to js. I saw it mentioned in git that "By default, steam-user will automatically save your machine auth tokens in your data directory,"so I didn't Don't know what's wrong with me. This is my entire process and I very much hope and thank you if you can answer my doubts:I specified my own data directory and it successfully generated a machineAuthToken.MyaccountName.txt file when I logged in for the first time, but when I ran it repeatedly it still prompted me to enter the steam guard code,So it looks like I don't need to pass the token manually since it's already generated in the folder I specified.
constructor(settings) {
super();
this.settings = settings;
this.busy = false;
this.steamClient = new SteamUser(Object.assign({
promptSteamGuardCode: false,
enablePicsCache: true // Required to check if we own CSGO with ownsApp
}, this.settings.steam_user));
this.csgoClient = new GlobalOffensive(this.steamClient);
// set up event handlers
this.bindEventHandlers();
// Variance to apply so that each bot relogins at different times
const variance = parseInt(Math.random() * 4 * 60 * 1000);
// As of 7/10/2020, GC inspect calls can timeout repeatedly for whatever reason
setInterval(() => {
if (this.csgoClient.haveGCSession) {
this.relogin = true;
this.steamClient.relog();
}
}, 30 * 60 * 1000 + variance);
}
logIn(username, password, auth) {
this.ready = false;
// Save these parameters if we login later
if (arguments.length === 3) {
this.username = username;
this.password = password;
this.auth = auth;
}
winston.info(`Logging in ${this.username}`);
// If there is a steam client, make sure it is disconnected
if (this.steamClient) this.steamClient.logOff();
this.loginData = {
accountName: this.username,
password: this.password,
rememberPassword: true,
};
if (this.auth && this.auth !== '') {
// Check if it is a shared_secret
if (this.auth.length <= 5) this.loginData.authCode = this.auth;
else {
// Generate the code from the shared_secret
winston.debug(`${this.username} Generating TOTP Code from shared_secret`);
this.loginData.twoFactorCode = SteamTotp.getAuthCode(this.auth);
}
}
winston.debug(`${this.username} About to connect`);
this.steamClient.logOn(this.loginData);
}