Skip to content

Latest commit

 

History

History
109 lines (73 loc) · 1.5 KB

README.md

File metadata and controls

109 lines (73 loc) · 1.5 KB

go-mcstatus

The official Go library for interacting with the mcstatus.io API.

Getting Started

Firstly, you will need to install the library. Open your terminal/command line in your workspace and run the following command.

go get github.com/mcstatus-io/go-mcstatus

Usage

Java Status

package main

import (
    "fmt"

    "github.com/mcstatus-io/go-mcstatus"
)

func main() {
    resp, err := mcstatus.GetJavaStatus("demo.mcstatus.io", 25565)

    if err != nil {
        panic(err)
    }

    fmt.Printf("%+v\n", resp)
}

Bedrock Status

package main

import (
    "fmt"
    
    "github.com/mcstatus-io/go-mcstatus"
)

func main() {
    resp, err := mcstatus.GetBedrockStatus("demo.mcstatus.io", 19132)

    if err != nil {
        panic(err)
    }

    fmt.Printf("%+v\n", resp)
}

Java Widget

package main

import "github.com/mcstatus-io/go-mcstatus"

func main() {
    img, err := mcstatus.GetJavaWidget("demo.mcstatus.io", 25565)

    if err != nil {
        panic(err)
    }

    // ...
}

Icon

package main

import "github.com/mcstatus-io/go-mcstatus"

func main() {
    img, err := mcstatus.GetIcon("demo.mcstatus.io", 25565)

    if err != nil {
        panic(err)
    }

    // ...
}

Default Icon

package main

import "github.com/mcstatus-io/go-mcstatus"

func main() {
    img := mcstatus.GetDefaultIcon()

    // ...
}

License

MIT License