xbox-live icon indicating copy to clipboard operation
xbox-live copied to clipboard

TypeError: Cannot read property 'GamerCard' of undefined

Open DasCalamity opened this issue 8 years ago • 7 comments

api.profile({ gamertag : 'Pravdin Linda' }, function(err, user){ if (err) return console.error(err); message.channel.send(user); }); was my code, I am not sure if this is a issue or not...

DasCalamity avatar Apr 17 '17 23:04 DasCalamity

Just saw this, I'll look at it this weekend.

khrome avatar Apr 29 '17 02:04 khrome

Alright I forgot to say it had something to do with "var api = new XBoxLive.Source.GamerCard();"

DasCalamity avatar May 01 '17 15:05 DasCalamity

So I was able to look at it this weekend: and I have some bad news: 1 - the docs are wrong and it's .Service rather than .Source... but this might not help you because 2 - it seems the Gamercard endpoints now are 360 specific and linked to your application code (try logging into an xbox 360 after enabling 2 factor auth on your MS account for a crash course on this). So the data you get back may not be exactly what you expect if it is an xbox one user.

Try this:

var XBoxLive = require('./xbox-live');
var api = new XBoxLive.Service.GamerCard();
api.profile({
    gamertag : 'khr0me'
}, function(err, data){
    console.log('return', arguments);
})

khrome avatar May 01 '17 16:05 khrome

Thank you so much! I will try it out tonight! I will report back when I do!

DasCalamity avatar May 01 '17 18:05 DasCalamity

Alright it worked! Thank you so much! Close the issue when you see this!

DasCalamity avatar May 02 '17 00:05 DasCalamity

Excellent, I'm going to leave this open as a reminder to fix the docs and will close it once complete. Glad it worked for you!

khrome avatar May 02 '17 01:05 khrome

yeah and also using it, it only works with xbox 360 profiles...

DasCalamity avatar May 02 '17 22:05 DasCalamity