Something undefined
See original GitHub issueEDIT
PokemonGO Servers down? 💯
Hello! I’m actually trying to create a simple web based Bot, and yeah. It’s a little bit strange, I don’t know what I did wrong. That’s a part of my “class”:
‘use strict’;
var PokemonGO = require(‘pokemon-go-node-api’);
const Logger = require(‘./Core/Logger.js’); const log = new Logger();
function Instance(provider, username, password, location) { log.dif(‘Starting PokémonGO NodeJS Bot, written by Kylon…’, ‘yellow’); if(provider !== null && username !== null && password !== null) { if(location !== null && typeof location == ‘object’) { var instance = new PokemonGO.Pokeio(); log.info(‘Trying to connect & initialize user…’); instance.init(username, password, location, provider, (err) => { if(err) { log.error(err); }
log.suc('Successfully logged in!'); log.info('Current location: ' + instance.playerInfo.locationName); log.info('lat/long/alt: ' + instance.playerInfo.latitude + '/' + instance.playerInfo.longitude + '/' + instance.playerInfo.altitude); log.suc('Trying to get user profile'); instance.GetProfile((err, profile) => { if(err) { log.error(err); } // Logging user infos log.dif('=========================', 'yellow'); log.info('Username: ' + profile.username);
and that’s what I’m getting in my console output:
[2016-07-27T16:36:28+02:00] Trying to connect & initialize user… [2016-07-27T16:36:29+02:00] Logging with user: xxx@gmail.com undefined [2016-07-27T16:36:29+02:00] Error: 403 error from server [2016-07-27T16:36:29+02:00] Successfully logged in! [2016-07-27T16:36:29+02:00] Current location: Times Square [2016-07-27T16:36:29+02:00] lat/long/alt: 40.759011/-73.9844722/0 [2016-07-27T16:36:29+02:00] Trying to get user profile
[2016-07-27T16:36:29+02:00] Error: Error
C:\Users\Frenk\Desktop\server\Instance.js:37 log.info('Username: ’ + profile.username); ^
TypeError: Cannot read property ‘username’ of undefined at C:\Users\Frenk\Desktop\server\Instance.js:37:42 at C:\Users\Frenk\Desktop\server\node_modules\pokemon-go-node-api\poke.io.js:240:16 at Request._callback (C:\Users\Frenk\Desktop\server\node_modules\pokemon-go-node-api\poke.io.js:131:16) at self.callback (C:\Users\Frenk\Desktop\server\node_modules\request\request.js:187:22) at emitOne (events.js:77:13) at Request.emit (events.js:169:7) at Request.init (C:\Users\Frenk\Desktop\server\node_modules\request\request.js:233:17) at new Request (C:\Users\Frenk\Desktop\server\node_modules\request\request.js:129:8) at request (C:\Users\Frenk\Desktop\server\node_modules\request\index.js:55:10) at C:\Users\Frenk\Desktop\server\node_modules\request\index.js:63:12
and that’s how I create the new instance:
var Instance = require(‘./Instance.js’); var pokemon = new Instance(‘google’, ‘mail’, ‘password’, { type: ‘name’, name: process.env.PGO_LOCATION || ‘Times Square’ });
Why I’m getting ‘undefined’ and btw. what’s undefined? The player object? Regards,
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Hey, does anybody know how to get user level?
@Armax would be awesome, if you can close it. For people w/ the same problem: https://github.com/Armax/Pokemon-GO-node-api/issues/94