Jump to content
McKay Development

'TypeError: listener must be a function' on SteamUser.logOff()


elixir

Recommended Posts

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.

Link to comment
Share on other sites

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?

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...