Jump to content
McKay Development

Calling an asynchronous function without callback is deprecated.


QWER

Recommended Posts

Hi.

 

I have little problem with my code. It says "DeprecationWarning: Calling an asynchronous function without callback is deprecated."

function SteamBot(name, autodecline) {
  var self = this;

  // all data
  this.accountData = data;

  console.log(data.steamid);
  this.steamid = data.steamid;
  this.login = data.name;
  this.password = data.password;
  this.shared = data.shared_secret;
  this.identity = data.identity_secret;

  this.autodecline = (typeof autodecline == 'undefined' ? true : autodecline);
  console.log(this.autodecline);

  this.cachedir = "private/bot/";
  this.pollPath = this.cachedir + 'polldata.json';
  
  this.loggedIn       = false;
  this.gotApiKey = false;
  this.error = false;

  this.inventory = [];

  this.client = new SteamUser();
  this.community = new SteamCommunity();
  this.client.setOption('promptSteamGuardCode', false);

  var managerConfig = {
    steam             : this.client,
    community         : this.community,
    domain            : "localhost",
    language          : "en",
//  pollInterval      : 3000,
//  cancelTime        : 600000,
//  pendingCancelTime : 30000
  };

  this.client.on('loggedOn', () => {
    this.loggedIn = true;
    this.client.setPersona(SteamUser.EPersonaState.Online)
  })

  this.manager = new TradeOfferManager(managerConfig);
  
  if (fs.existsSync(this.cachedir + 'polldata.json')) {
    this.manager.pollData = JSON.parse(fs.readFileSync(this.cachedir + 'polldata.json'));
  }
  
  this.manager.on('pollData', function(pollData) {
    console.log("pollData > " + self.cachedir);
    fs.writeFile(self.cachedir + 'polldata.json', JSON.stringify(pollData));
  });

  this.manager.on('newOffer', function(offer) {
    console.log("newOffer"); 
    offer.decline(function(err) {
      if (err) {
        console.log("[SteamBotsHandler] BOT " + self.name + " unable to decline offer: " + err.message);
      }
    });
  });

}

Here is log...

newOffer
newOffer
pollData > private/bots_cache/csgocloudbot2/
(node:24579) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
pollData > private/bots_cache/csgocloudbot2/
(node:24579) DeprecationWarning: Calling an asynchronous function without callback is deprecated.

I have latest version of tradeoffer manager. What to do?

 

Cheers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...