Skip to content

Latest commit

 

History

History
68 lines (57 loc) · 1.47 KB

README.md

File metadata and controls

68 lines (57 loc) · 1.47 KB

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
  }
}