Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to master #4861

Merged
merged 10 commits into from
Aug 28, 2016
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# PokemonGo-Bot
PokemonGo bot is a project created by the [PokemonGoF](https://github.com/PokemonGoF) team.

## Table of Contents
- [Installation](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/installation.md)
- [Documentation](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/)
- [Support](#support)
- [help](#configuration-issueshelp)
- [bugs](#bugs--issues)
- [Feature request](#feature-requests)
- [Pull Requests](#pull-requests)
- [Features](#features)
- [Credits](#credits)

The project is currently setup in two main branches.
- `dev` also known as `beta` - This is where the latest features are, but you may also experience some issues with stability/crashes
- `master` also known as `stable` - The bot 'should' be stable on this branch, and is generally well tested

## [Desktop version](https://github.com/PokemonGoF/PokemonGo-Bot-Desktop)

## Support
###Configuration issues/help
### Configuration issues/help
If you need any help please don't create an issue as we have a great community on Slack. You can count on the community in [#help](https://pokemongo-bot.slack.com/messages/help/) channel.
- [Click here to signup (first time only)](https://pokemongo-bot.herokuapp.com)
- [Join if you're already a member](https://pokemongo-bot.slack.com/messages/general/).
Expand All @@ -23,12 +32,6 @@ While you're there vote on other feature requests to let the devs know what is m
###[Pull Requests](https://github.com/PokemonGoF/PokemonGo-Bot/pulls)
If you'd like to make your own changes, make sure you follow the pull request template, and ensure your PR is made against the 'dev' branch

## Table of Contents
- [Installation](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/installation.md)
- [Documentation](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/)
- [Features](#features)
- [Credits](#credits)

## Features
- [x] GPS Location configuration
- [x] Search Pokestops
Expand Down
10 changes: 6 additions & 4 deletions configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,12 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"logging": {
"color": true,
"clean": false
},
"logging": {
"color": true,
"show_datetime": true,
"show_process_name": true,
"show_log_level": true
},
"catch": {
"any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
"// Example of always catching Rattata:": {},
Expand Down
10 changes: 6 additions & 4 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,12 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"logging": {
"color": true,
"clean": false
},
"logging": {
"color": true,
"show_datetime": true,
"show_process_name": true,
"show_log_level": true
},
"catch": {
"any": {"candy_threshold" : 400 ,"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
"// Example of always catching Rattata:": {},
Expand Down
11 changes: 7 additions & 4 deletions configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
"config": {
"enabled": true,
"address": "http://localhost:5000",
"//NOTE: Change the max_distance to adjust the max sniping range (km)": {},
"max_distance": 500,
"min_ball": 50,
"prioritize_vips": true,
Expand Down Expand Up @@ -485,10 +486,12 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"logging": {
"color": true,
"clean": false
},
"logging": {
"color": true,
"show_datetime": true,
"show_process_name": true,
"show_log_level": true
},
"catch": {
"any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
"// Example of always catching Rattata:": {},
Expand Down
10 changes: 6 additions & 4 deletions configs/config.json.optimizer.example
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,12 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"logging": {
"color": true,
"clean": false
},
"logging": {
"color": true,
"show_datetime": true,
"show_process_name": true,
"show_log_level": true
},
"catch": {
"any": {
"always_catch": true
Expand Down
10 changes: 6 additions & 4 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,12 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"logging": {
"color": true,
"clean": false
},
"logging": {
"color": true,
"show_datetime": true,
"show_process_name": true,
"show_log_level": true
},
"catch": {
"any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
"// Example of always catching Rattata:": {},
Expand Down
10 changes: 6 additions & 4 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,12 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"logging": {
"color": true,
"clean": false
},
"logging": {
"color": true,
"show_datetime": true,
"show_process_name": true,
"show_log_level": true
},
"catch": {
"any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or" },

Expand Down
43 changes: 42 additions & 1 deletion docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- [Random Pause](#random-pause)
- [Egg Incubator](#egg-incubator)
- [ShowBestPokemon](#showbestpokemon)
- [Telegram Task](#telegram-task)

#Configuration files

Expand Down Expand Up @@ -85,7 +86,15 @@ Document the configuration options of PokemonGo-Bot.
|`favorite_locations` | [] | Allows you to define a collection of locations and coordinates, allowing rapid switch using a "label" on your location config
| `live_config_update.enabled` | false | Enable live config update
| `live_config_update.tasks_only` | false | True: quick update for Tasks only (without re-login). False: slower update for entire config file.
| `enable_social` | true | True: to chat with other pokemon go bot users [more information](https://github.com/PokemonGoF/PokemonGo-Bot/pull/4596)

## Logging configuration
[[back to top](#table-of-contents)]

'logging'.'color' (default false) Enabled colored logging
'logging'.'show_datetime' (default true) Show date and time in log
'logging'.'show_process_name' (default true) Show name of process generating output in log
'logging'.'show_log_level' (default true) Show level of log message in log (eg. "INFO")

## Configuring Tasks
[[back to top](#table-of-contents)]
Expand Down Expand Up @@ -542,7 +551,7 @@ This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map i
* `prioritize_vips` - Will prioritize vips in distance and priority mode above all normal pokemon if set to true
* `min_time` - Minimum time the pokemon has to be available before despawn
* `min_ball` - Minimum amount of balls required to run task
* `max_distance` - Maximum distance the pokemon is allowed to be when walking, ignored when sniping
* `max_distance` - Maximum distance the pokemon is allowed to be when sniping. (km)
* `snipe`:
- `True` - Will teleport to target pokemon, encounter it, teleport back then catch it
- `False` - Will walk normally to the pokemon
Expand All @@ -564,6 +573,7 @@ This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map i
"type": "MoveToMapPokemon",
"config": {
"address": "http://localhost:5000",
"//NOTE: Change the max_distance to adjust the max sniping range (km)": {},
"max_distance": 500,
"min_time": 60,
"min_ball": 50,
Expand Down Expand Up @@ -904,3 +914,34 @@ Available `info_to_show` :
```
2016-08-25 21:20:59,642 [ShowBestPokemon] [INFO] [show_best_pokemon] [Tauros, CP 575, IVCP 0.95, DPS 12.04] | [Grimer, CP 613, IVCP 0.93, DPS 13.93] | [Tangela, CP 736, IVCP 0.93, DPS 14.5] | [Staryu, CP 316, IVCP 0.92, DPS 10.75] | [Gastly, CP 224, IVCP 0.9, DPS 11.7]
```

## Telegram Task
[[back to top](#table-of-contents)]

### Description
[[back to top](#table-of-contents)]

[Telegram bot](https://telegram.org/) Announcer Level up, pokemon cought

Bot answer on command '/info' self stats.

### Options

* `telegram_token` : bot token (getting [there](https://core.telegram.org/bots#6-botfather) - one token per bot)
* `master` : id (without quotes) or username (in quotes, first character @) of bot owner, who will gett announces.
* `alert_catch` : array of pokemons, which will be announced on catch. if first array item `all` - announce all pokemons.

### Sample configuration
[[back to top](#table-of-contents)]
```json
{
"type": "TelegramTask",
"config": {
"enabled": true,
"master": 12345678,
"//master": "@username",
"alert_catch": ["Lapras","Dragonite"],
"//alert_catch": ["all"]
}
}
```
6 changes: 4 additions & 2 deletions docs/manual_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ mv pgoencrypt/src/libencrypt.so encrypt.so
```bash
cp configs/config.json.example configs/config.json
vi configs/config.json
cp configs/auth.json.example configs/auth.json
vi configs/auth.json
```
####
- make shure your git repo is up to date
Expand All @@ -78,15 +80,15 @@ pip install -r requirements.txt
####
- finaly start the bot
```bash
./run.sh configs/config.json
./run.sh
```
####
- after reboot or closing the terminal at every new start go into the folder of the PokemonGo-Bot by going into the folder where you startet installing it an then
```bash
cd PokemonGo-Bot
#activate virtualenv and start
source bin/activate
./run.sh configs/config.json
./run.sh
```


Expand Down
8 changes: 6 additions & 2 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def _json_loader(filename):
type=bool,
default=False
)

# Start to parse other attrs
config = parser.parse_args()
if not config.username and 'username' not in load:
Expand All @@ -652,6 +652,7 @@ def _json_loader(filename):
config.live_config_update = load.get('live_config_update', {})
config.live_config_update_enabled = config.live_config_update.get('enabled', False)
config.live_config_update_tasks_only = config.live_config_update.get('tasks_only', False)
config.logging = load.get('logging', {})

if config.map_object_cache_time < 0.0:
parser.error("--map_object_cache_time is out of range! (should be >= 0.0)")
Expand Down Expand Up @@ -696,7 +697,10 @@ def task_configuration_error(flag_name):

if "daily_catch_limit" in load:
logger.warning('The daily_catch_limit argument has been moved into the CatchPokemon Task')


if "logging_color" in load:
logger.warning('The logging_color argument has been moved into the logging config section')

if config.walk_min < 1:
parser.error("--walk_min is out of range! (should be >= 1.0)")
return None
Expand Down
25 changes: 22 additions & 3 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def start(self):
def _setup_event_system(self):
handlers = []

if self.config.logging_color:
if self.config.logging and 'color' in self.config.logging and self.config.logging['color']:
handlers.append(ColoredLoggingHandler(self))
else:
handlers.append(LoggingHandler(self))
Expand Down Expand Up @@ -183,6 +183,8 @@ def _register_events(self):
self.event_manager.register_event('set_start_location')
self.event_manager.register_event('load_cached_location')
self.event_manager.register_event('location_cache_ignored')

self.event_manager.register_event('debug')

# ignore candy above threshold
self.event_manager.register_event(
Expand Down Expand Up @@ -592,6 +594,12 @@ def _register_events(self):
'moving_to_pokemon_throught_fort',
parameters=('fort_name', 'distance','poke_name','poke_dist')
)
self.event_manager.register_event(
'move_to_map_pokemon',
parameters=('message')
)



# cached recent_forts
self.event_manager.register_event('loaded_cached_forts')
Expand Down Expand Up @@ -760,8 +768,19 @@ def _setup_logging(self):
logging.getLogger("pgoapi").setLevel(log_level)
logging.getLogger("rpc_api").setLevel(log_level)

if self.config.logging_clean and not self.config.debug:
formatter = Formatter(fmt='[%(asctime)s] %(message)s', datefmt='%H:%M:%S')
if self.config.logging:
logging_format = '%(message)s'
logging_format_options = ''

if ('show_log_level' not in self.config.logging) or self.config.logging['show_log_level']:
logging_format = '[%(levelname)s] ' + logging_format
if ('show_process_name' not in self.config.logging) or self.config.logging['show_process_name']:
logging_format = '[%(name)10s] ' + logging_format
if ('show_datetime' not in self.config.logging) or self.config.logging['show_datetime']:
logging_format = '[%(asctime)s] ' + logging_format
logging_format_options = '%Y-%m-%d %H:%M:%S'

formatter = Formatter(logging_format,logging_format_options)
for handler in logging.root.handlers[:]:
handler.setFormatter(formatter)

Expand Down
Loading