Jump to content
McKay Development

Rules

Member
  • Posts

    2
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Rules reacted to Dr. McKay in Parsing Users' Rich Presence   
    This is incredibly nooby but hey, we all start somewhere, right? Props for wanting to learn and not wanting everything just handed to you.
     
    You'd want to create an object and store it in a variable (e.g. let richPresence = {};), then loop over the array and set properties in that object (using bracket notation). So, this:
    let richPresence = {}; // create a new, empty object (sClient.users[sID].rich_presence || []).forEach((element) => { // Loop over the rich_presence array. If it happens to be missing, substitute it using || for // an empty array so we don't end up crashing by trying to reference forEach on undefined/null. richPresence[element.key] = element.value; }); console.log(richPresence.status); // Playing CS:GO
  2. Like
    Rules got a reaction from Dr. McKay in Parsing Users' Rich Presence   
    I wrote a whole 'lil DiscordJS//steam-user bot to tell the homies the score of the match and then discovered the globaloffensive module. Now I'm delving down the hole of all the information I can retrieve from that. This is quite the learning experience. I really should've started with some Node tutorials    
×
×
  • Create New...