A Golang implementation of Pokemon-Go's API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
auth.go
auth_events.go
client.go
client_events.go
fort.go
fort_events.go
gym.go
location.go
location_events.go
map.go
map_events.go
pokemon.go
task.go

README.md

Pokemon-Golang

Pokemon-Golang is not necessarily a bot, but it provides the set of tools in a very easy to use way to create your own bot that is custom to your needs. Examples will be released a long the way, and my own version of a bot built using this very simple API

Driven by Go's channels, concurrency, and amazingly fast protobuf interacting, this is aimed to be the fastest implementation of Pokemon-Gos API for easily building a fast, reliable, automated bot.

Please look at the dev branch if there haven't been any commits to the master branch in a bit.

TODO

  • Authentication with Google
  • Authentication with Pokemon Trainers Club
  • View Pokemon / Forts Nearby You
  • Visit Pokestops
  • Farm Pokestops
  • GPS Spoofing Interpolated As Human
  • Tasking System
  • Catch Pokemon
  • Catch Only Certain Pokemon
  • Remove Excess Items When Over X Quantities
  • Transfer Flagged Pokemon
  • Auto Hatch Eggs
  • Evolve Pokemon
  • Make Errors More Descriptive For Easier Debugging

TODO Extras

  • Add priority system to the tasking system to deem certain things more important so they run before other things (e.g. catch a rare pokemon over visiting a pokestop)

Example Usage

package main

import (
	"log"
	"reflect"

	"github.com/Gacnt/pokemon-go"
)

func main() {
	client := pgo.NewClient()
	loginInfo := new(pgo.LogOnDetails)
	loginInfo.Username = "Username"
	loginInfo.Password = "Password"
	loginInfo.AuthType = "ptc"

	client.Auth.GetToken(loginInfo)
	for event := range client.Events() {
		switch e := event.(type) {
		case *pgo.AuthedEvent:
			client.Auth.SetAuthToken(e.AuthToken)
			client.Location.SetByLocation("New York")
			client.Auth.Login()
		case *pgo.LoggedOnEvent:
			client.SetAPIUrl(e.APIUrl)
			go func() {
				for {
					go pgo.GetMapData(client)
					time.Sleep(2 * time.Second)
				}
			}()
		case *pgo.LocationSet:
			log.Println("Location has been set")
			log.Printf("%+v", *e.Location)
		case *pgo.MovingUpdateEvent:
			log.Println("Bot is walking")
			log.Println(e.DistanceTravelled, e.DistanceTotal)
		case *pgo.MovingDirectionChangedEvent:
			log.Println("Changed")
		case *pgo.FortSearchedEvent:
			log.Printf("%+v", e.Result)
		case *pgo.FortEvent:
			for _, fort := range e.Forts {
				client.Task.AddFunc(fort.Id, func() {
					fort.Search(client)
				}) // ADD OPTIONAL PRIORITY SETTING AS 3RD PARAMETER
			}
		case *pgo.FatalErrorEvent:
			log.Println(e.Err)
		default:

		}
	}
}

For documentation please visit https://godoc.org/github.com/Gacnt/pokemon-golang

This API structure was heavily inspired by Philipp15b's Go Steam API