Skip to content

Commit

Permalink
api example
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed May 6, 2022
1 parent 204fa0a commit 5369293
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,44 @@ Usage of ./minetest_client:
The username (default "test")
```

# Api

```golang
package main

import (
"github.com/minetest-go/minetest_client/commandclient"
)

func main() {
host := "127.0.0.1"
port := 30000
username := "test"
password := "test"

client := commandclient.NewCommandClient(host, port)
err := client.Connect()
if err != nil {
panic(err)
}

err = commandclient.Init(client, username)
if err != nil {
panic(err)
}

err = commandclient.Login(client, username, password)
if err != nil {
panic(err)
}

err = commandclient.ClientReady(client)
if err != nil {
panic(err)
}
}
```

# License

MIT

0 comments on commit 5369293

Please sign in to comment.