tvman99 Posted September 6, 2018 Report Posted September 6, 2018 I have variable that contains steamid64. There is a reason using variable, Because it changes. This id event is not working, However it does with const. Does it work only with const? If yes, How can i make it work? client.on('friendMessage#' + variable, function(steamID, message) { console.log("works"); client.chatMessage(steamID, "works " + message); }); Quote
tvman99 Posted September 6, 2018 Author Report Posted September 6, 2018 (edited) It works with initial value. So I think i should clear cache and refresh after every changes somehow. How can i achieve it without restarting whole nodejs app? Edit: I found a way and it is only to check steamid is equal to variable within friendMessage id event. Edited September 6, 2018 by tvman99 Quote
Dr. McKay Posted September 6, 2018 Report Posted September 6, 2018 As you discovered, calling client.on('friendMessage#' + variable, ...) only creates a listener for the SteamID contained in variable at the time the listener was added. If you need to change the SteamID you're listening for, you need to just listen for friendMessage and check the SteamID in the event. Quote
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.