Jump to content


Photo

ID event is not firing

node.js node-steam-user

Best Answer Dr. McKay , 06 September 2018 - 10:46 AM

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.

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 tvman99

tvman99

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 06 September 2018 - 06:47 AM

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);
});


#2 tvman99

tvman99

    Newbie

  • Member
  • Pip
  • 7 posts

Posted 06 September 2018 - 07:03 AM

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 by tvman99, 06 September 2018 - 07:11 AM.


#3 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,815 posts

Posted 06 September 2018 - 10:46 AM   Best Answer

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.







Also tagged with one or more of these keywords: node.js, node-steam-user

3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users