Trajko Posted February 26, 2021 Report Share Posted February 26, 2021 (edited) Hi, how can I fix this: Error: this.client.webLogOn(); ^ TypeError: Cannot read property 'webLogOn' of undefined Code: this.community.on('sessionExpired', function() { this.client.webLogOn(); }); This code is inside SteamBot constructor class Edited February 26, 2021 by Trajko Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted February 27, 2021 Report Share Posted February 27, 2021 Inside of that callback function, this refers to the SteamCommunity instance and not the outer context's this. Replace that with an arrow function and it should work as you expect. this.community.on('sessionExpired', () => { this.client.webLogOn(); }); 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.