PokemonGoBot icon indicating copy to clipboard operation
PokemonGoBot copied to clipboard

[Bug in 0.4.1] Error when restart the bot (for a new location)

Open casper-gh opened this issue 10 years ago • 15 comments

Description: Since the bot does not support multiple locations, I had to create some cron entries which modifies the config file for a new GPS coordinates every 5 minutes.

So basically I just terminate the running program using pkill -f bot.jar and re-run the program with modified config file. It worked in older version, but in 0.4.1, I got an error and the program halts forever.

Steps to reproduce:

  1. Run the bot
  2. Kill the bot using pkill -f bot-jar-file-name.jar
  3. Edit the config file for new location (close by)
  4. Re-run the bot

Expected behavior: Should see the logs.

Actual behavior: (not everything)

04:28:01.357 [Thread-6] INFO org.springframework.context.annotation.AnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1ae4b3b8: startup date [Mon Jul 25 04:24:01 UTC 2016]; root of context hierarchy
04:28:01.357 [Thread-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
04:28:01.357 [Thread-6] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@28f270bc: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,main,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,botRunService,botConfiguration,httpClient,org.springframework.boot.autoconfigure.AutoConfigurationPackages]; root of factory hierarchy

Version: 0.4.1

casper-gh avatar Jul 25 '16 04:07 casper-gh

same thing happened to me except i was just closing out of the bot changing something in config and relaunching it.

Edit: seemed to have fixed my issue by going into folder/bot-settings and deleting .json

MrJokerer avatar Jul 25 '16 05:07 MrJokerer

Open your config file under /bot-settings/*.json Make sure that the JSON is properly formatted.

Paste it here if you need help and paste the stacktrace.

ursalame avatar Jul 25 '16 05:07 ursalame

@ursalame So the config is moved to /bot-settings/ folder?

casper-gh avatar Jul 25 '16 05:07 casper-gh

@ursalame I get a similar error when attempting to change settings in the config file. Tried deleting the token and restarting the bot however I get this after

{ "name" : "config-properties-conversion", "startingLatitude" : 34.00887939596222, "startingLongitude" : -118.48673995034731, "credentials" : { "type" : "google" }

^ Current (after deleting the token)

Caused by: java.lang.IllegalArgumentException: No save file found for name: .DS_Store

Error upon restart

@casper-gh It creates the json file (which has some more settings in it) after your first run of the program. My problem is any time I try to change it by stopping the bot -> changing json -> restarting I get some errors

PalletTownHero avatar Jul 25 '16 05:07 PalletTownHero

@PalletTownHero that explains...

But when we restart the bot, isn't it suppose to create a new json file in bot-settings/ based on the new config.properties?

casper-gh avatar Jul 25 '16 05:07 casper-gh

@PalletTownHero Here is how your JSON should look like:

@casper-gh Yes you need to create a new folder next to your .jar file and name it bot-settings and then inside that folder create a JSON file "config-properties-conversion".

Try using this JSON config file. You change change the JSON file name and the name inside the JSON, change startingLatitude and startingLongitude to your needs, don't go over 7 numbers after the dot.

{
  "name" : "config-properties-conversion",
  "startingLatitude" : 34.0088793,
  "startingLongitude" : -118.4867399,
  "credentials" : {
    "type" : "google",
    "token" : ""
  },
  "speed" : 2.778,
  "shouldDropItems" : true,
  "preferredBall" : "ITEM_POKE_BALL",
  "shouldAutoTransfer" : true,
  "shouldDisplayKeepalive" : true,
  "shouldDisplayWalkingToNearestUnused" : true,
  "shouldDisplayPokestopSpinRewards" : true,
  "shouldDisplayPokestopName" : true,
  "shouldDisplayPokemonCatchRewards" : true,
  "shouldHatchEggs" : true,
  "keepPokemonAmount" : 1,
  "desiredCatchProbability" : 0.8,
  "transferIVThreshold" : 80,
  "transferCPThreshold" : 1000,
  "ignoredPokemon" : [ "EEVEE", "MEWTWO", "MEW", "VAPOREON" ],
  "obligatoryTransfer" : [ "PIDGEY" ],
  "walkOnly" : false,
  "sortByIV" : false,
  "uselessItems" : {
    "ITEM_REVIVE" : 20,
    "ITEM_MAX_REVIVE" : 10,
    "ITEM_POTION" : 0,
    "ITEM_SUPER_POTION" : 0,
    "ITEM_HYPER_POTION" : 30,
    "ITEM_MAX_POTION" : 50,
    "ITEM_POKE_BALL" : 50,
    "ITEM_GREAT_BALL" : 50,
    "ITEM_ULTRA_BALL" : 50,
    "ITEM_MASTER_BALL" : 50,
    "ITEM_RAZZ_BERRY" : 50
  }
}

ursalame avatar Jul 25 '16 05:07 ursalame

@casper-gh Forgive me if its obvious, I'm a noob lol.

Deleting the bot-settings folder entirely and re-authenticating through google.com/device with generated code gets it running, however the properties are not transferring over completely and correctly, always keep and always toss pokemon are transferred over but the lines like transfer CP threshold and useless items don't. Not sure why.

PalletTownHero avatar Jul 25 '16 05:07 PalletTownHero

@ursalame Thanks! I formatted it wrong :o 👍

PalletTownHero avatar Jul 25 '16 05:07 PalletTownHero

@ursalame Is this file auto-generated? if I want to edit the coordinates, should I edit config.properties or bot-settings/config-properties-conversion.json ?

casper-gh avatar Jul 25 '16 05:07 casper-gh

The file should be generated but try creating your own with the JSON file I posted.

To change your coordinates you need to edit bot-settings/config-properties-conversion.json

ursalame avatar Jul 25 '16 05:07 ursalame

@casper-gh @ursalame Removing whatever is between the token : "" along with edits to the parameters in the JSON file seems to work. Thanks for your help! :)

PalletTownHero avatar Jul 25 '16 05:07 PalletTownHero

@ursalame @PalletTownHero So what if I just delete the entire bot-settings/config-properties-conversion.json, would the bot regenerates a new one when it restarts?

I don't want to rewrite my script to edit coordinates on the fly.

casper-gh avatar Jul 25 '16 05:07 casper-gh

@casper-gh I found you don't need to delete it, simply delete anything between the quotes from the token Oh also it does regenerate a new one but it won't have every setting for example the items and CP seem to be set to a default as well as the egg hatching { "name" : "config-properties-conversion", "startingLatitude" : xxxxxxxxx, "startingLongitude" :xxxxxxxx, "credentials" : { "type" : "google", "token" : "delete anything in here" },

Restart and re-do authentication (if using google)

PalletTownHero avatar Jul 25 '16 06:07 PalletTownHero

@PalletTownHero Thanks, but deleting a folder only needs a simple command.

Still got some other errors and the bot keeps going back to the same pokestop, anyway I'm going back to .3.0, seems very stable for me

casper-gh avatar Jul 25 '16 06:07 casper-gh

Issue is fixed because the JSON thingy is gone again

jabbink avatar Jul 25 '16 09:07 jabbink