go-serverapi/custom.go

26 lines
604 B
Go

package serverapi
import "fmt"
// Broadcast is a server-wide message
type Broadcast struct {
From string `json:"from"`
Message string `json:"message"`
}
// Broadcast sends a message to the server
func (c *Client) Broadcast(b Broadcast) (int, error) {
return c.jsonPOST(fmt.Sprintf("%s/broadcast", c.endpoint), b)
}
// Custom is for edge-cases
type Custom struct {
Command string `json:"command"`
Args []string `json:"args"`
}
// Custom sends a custom command to the server
func (c *Client) Custom(cu Custom) (int, error) {
return c.jsonPOST(fmt.Sprintf("%s/custom", c.endpoint), cu)
}