elixir Posted April 7, 2016 Report Share Posted April 7, 2016 I'm currently writing a bot management system and stuck on disconnecting bots. Whenever I call logOff() function, I get an error that crashes my application. events.js:276 throw new TypeError('listener must be a function'); ^ TypeError: listener must be a function at CMClient.removeListener (events.js:276:15) at SteamUser.logOff.SteamUser.disconnect (E:\Projects\steam-bot-manager\node_modules\steam-user\components\logon.js:151:14) ... The line 151 of logon.js is: this.client.removeListener('connected', this._onConnected);Any ideas why this happens? P.S. I already tried handling 'error' and 'disconnected' events. No success. Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted April 7, 2016 Report Share Posted April 7, 2016 The only way I was able to reproduce this was by trying to log off without first being logged on. Please make sure you aren't doing that. Quote Link to comment Share on other sites More sharing options...
elixir Posted April 7, 2016 Author Report Share Posted April 7, 2016 The only way I was able to reproduce this was by trying to log off without first being logged on. Please make sure you aren't doing that. Yes, that was the problem. Thank you.Is it supposed to behave like that? Maybe just make this function return false or throw an error in this case? Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted April 7, 2016 Report Share Posted April 7, 2016 It might be a better idea to throw a more descriptive error, but the behavior is pretty much undefined for calling any method (except for offline ones like settings and logon) while logged off. 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.