QWER Posted January 4, 2017 Report Share Posted January 4, 2017 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 Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted January 5, 2017 Report Share Posted January 5, 2017 As of node 7, you aren't supposed to call fs.writeFile without providing a callback. It doesn't have to do anything, it just has to exist. Quote Link to comment Share on other sites More sharing options...
QWER Posted January 5, 2017 Author Report Share Posted January 5, 2017 Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.