Jump to content
McKay Development

lll

Member
  • Content Count

    7
  • Joined

  • Last visited

  1. After I log out hrough my method logOut() { this.manager.shutdown(); this.user.logOff(); } there is one non-closed timer on - (43200000 ~ 12 hr) (anonymous) @ ...\steamcommunity\components\confirmations.js:172 and therefore my program does not exit correctly
  2. no, this class field is not initialized through the constructor, so this is not needed this code is equivalent of export default class Bot { constructor(details, db) { this.jar = request.jar(); this.request = request.defaults({ jar: this.jar, headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' } }); this.community = new SteamCommunity({ request: this.request }); } }
  3. and another question, why the cookie jar is not used, which is passed in request.defaults export default class Bot { jar = request.jar(); request = request.defaults({ jar: this.jar, headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' } }); constructor(details, db) { this.community = new SteamCommunity({ request: this.request }); } } after login and several requests, I can’t get Steam cookies in jar
  4. request has been deprecated, so is planned to switch to another requests lib?
  5. This logic will be written in the constructor. Something like this : constructor(accountName) { this.setCookies = util.promisify(this.manager.setCookies).bind(this.manager); this.user.on('error', this.logOut); this.user.on('loginKey', loginKey => db.findOne('bot', { accountName }, { loginKey })); }
  6. I have a Bot class and an async method for logIn, are there any better way for writing this method? completeLogin(botDetails, useLoginKey) { this.user.logOn(this.details(botDetails, useLoginKey)); return new Promise((done, reject) => { const cxt = this; async function success(_, cookies) { try { await cxt.setCookies(cookies); cxt.user.off('error', failed); done(); } catch(err) { reject(err); } } function failed(err) { cxt.user.off('webSession', success); reject(err); } cxt.user.once('webSession', success); cxt.user.once('error', failed); }); }
×
×
  • Create New...