How should I modify the config file, and starting command to use more than one bot at a time?How should I modify the config file, and starting command to use more than one bot at a time?
I'll see if I can Update wiki with answer once I get it
Can't you repeat the steps and you can have more bot running.
I suppose I could copy the entire folder for each new bot I wanted to run, but I know there is a better way to do it than that.
You only need one copy of the repository. I'm using the following folder structure:
--pogobot
|--bot.sh
|--clone.sh
|--server.sh
|--cfg
|--red.json
|--blue.json
|--userdata.json
|--PokemonGo-Bot
|--web
|--userdata.json (symbolic link to ../../cfg/userdata.json)
|--(the rest of the github repo, which I don't mess with...)
red.json and blue.json would be config files for different accounts. The logins for those accounts get added to the users array in userdata.json:
var users = ["[email protected]", "[email protected]"];
Passwords, Google Maps API Key, all that other stuff gets set in these files as well.
clone.sh deletes the PokemonGo-Bot folder and recreates it - makes it easy to update without losing my configuration changes.
#!/bin/bash
rm -rf PokemonGo-Bot 2> /dev/null
git clone -b dev https://github.com/PokemonGoF/PokemonGo-Bot
cd PokemonGo-Bot
./install.sh
cd web
ln -s ../../cfg/userdata.js userdata.js
bot.sh runs an instance of the bot. I pass the config file to use as a command line argument to it.
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: run [playername]"
echo " where [playername] is a JSON file in the cfg subdirectory."
exit 0
fi
cd PokemonGo-Bot
source bin/activate
until (python pokecli.py --config ../cfg/$1.json); do
echo "Process crashed with exit code $?. Respawning.." >&2
sleep 360
done
server.sh just runs a webserver on port 8000 in the web subdirectory
#!/bin/bash
cd PokemonGo-Bot/web
python -m SimpleHTTPServer 8000
I use tmux, but multiple instances of Terminal, multiple tabs, whatever works for you is fine too. In one shell, I run ./server.sh, in a second, I run ./bot.sh red, and in a third, ./bot.sh blue. I can watch the instances do their thing in each shell, and keep an eye on the map in my browser at http://localhost:8000.
That's rather confusing for me, especially considering I don't know Python and I dont have a default userdata file. This new version is so much more complex. I wish I could just do -a/-u/-p/-l/ etc like the old versions to do different accounts.
Anyway, would you kindly ELI5 the website thing for me? for one instance, assuming it's set up the default way?
Don't copy the entire folder :) You only have to copy the config files.
This is my setup (dev branch):
-- bot
|--configs
|--config.1.json
|--config.2.json
|--config.3.json
|--config.4.json
|--run1.cmd
|--run2.cmd
|--run3.cmd
|--run4.cmd
The configs here contain the exact same information, only the username and password are different. The run1.cmd etc, contain the following code (this code also automatically reruns the script when an error occures):
@echo off
:Execute
python ./pokecli.py --config ./configs/config.1.json
IF ERRORLEVEL 1 GOTO :RETRY
:RETRY
@echo (%date% %time%) Oooh snap, an error occured, let's try again!
GOTO :Execute
All you have to do here is replace the config name for each cmd file :)
Saves you a lot of diskspace and efforts :)
@skellyton5 You do have a default userdata.js file - it's in PokemonGo-Bot/web/userdata.js.example - just copy it to userdata.js, put in your usernames and your google API key and you're good to go.