samuri51 / chillybot

a turntable bot created by a moderator of straight_chillin11
12 stars 12 forks source link

Added additional data to who snagged #2

Closed btburbank closed 11 years ago

btburbank commented 11 years ago

Added this: "bot.speak('@' + name + ' Went to Jared! <3');" to whoSnagged += 1; ...

Reports wrong user who snagged.

samuri51 commented 11 years ago

name is an arbitrary variable name i made to refer to something else, its also local to only that function. try this instead

 bot.getProfile(data.userid, function(data2)
      {
        bot.speak('@' + data2.name + ' Went to Jared! <3');
          /* 
          data2 is just a name i chose, and .name is a field in the callback object
          you can only access it within the callback function 
          */
      });  

to see all the options in the callback function try adding console.log(data2); underneath bot.speak

btburbank commented 11 years ago

And I'd put that directly after whoSnagged += 1; ?

samuri51 commented 11 years ago

yes