Skip to content

eminarican/haxballgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Haxballgo

Haxball room API for Go

License GitHub Issues GitHub Stars

💡 Simple usage

go get github.com/eminarican/haxballgo@0.0.1
func main() {
  r := room.New()
  defer r.Shutdown()
  
  l := r.Logger()
  s := r.Scheduler()

  r.OnPlayerJoin(func(p *room.Player) {
	  l.Infof("Player %v joined!", p.Name())
  })

  r.OnPlayerLeave(func(p *room.Player) {
	  l.Infof("Player %v leaved!", p.Name())
  })

  s.Repeating(time.Second, func(stop func()){
    r.Announce("Test message")
  })
}
# auto-generated config.json
{
  "Bot": {
    "Active": false,
    "Name": "Bot"
  },
  "General": {
    "Name": "My Room",
    "Token": "",
    "MaxPlayer": 16
  },
  "Security": {
    "Public": true,
    "Password": ""
  },
  "Logging": {
    "Debug": false,
    "Pretty": true
  }
}