mcgo

package module
v0.2.99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 14 Imported by: 1

README

MC GO

MC API requests implemented in go

It is planned to make a free & open source CLI for this, and a paid web UI and Discord Bot!

cli link: https://github.com/Kqzz/MCsniperGO

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NameAvailability added in v0.2.3

func NameAvailability(username string) (string, error)

Types

type AccType

type AccType string
const (
	Ms   AccType = "ms"
	Mj   AccType = "mj"
	MsPr AccType = "mspr"
)

type Droptime

type Droptime struct {
	Droptime time.Time
	Username string
}

type MCaccount

type MCaccount struct {
	Email             string
	Password          string
	SecurityQuestions []SqAnswer
	SecurityAnswers   []string
	Bearer            string
	UUID              string
	Username          string
	Type              AccType
	Authenticated     bool
}

represents a minecraft account

func (*MCaccount) AuthenticatedReq

func (account *MCaccount) AuthenticatedReq(method string, url string, body io.Reader) (*http.Request, error)

func (*MCaccount) ChangeName

func (account *MCaccount) ChangeName(username string, changeTime time.Time, createProfile bool) (NameChangeReturn, error)

func (*MCaccount) ChangeSkinFromUrl added in v0.2.93

func (account *MCaccount) ChangeSkinFromUrl(url, variant string) error

func (*MCaccount) HasGcApplied added in v0.1.91

func (account *MCaccount) HasGcApplied() (bool, error)

func (*MCaccount) InitAuthFlow added in v0.2.92

func (account *MCaccount) InitAuthFlow() error

func (*MCaccount) LoadAccountInfo

func (account *MCaccount) LoadAccountInfo() error

load account information (username, uuid) into accounts attributes, if not already there. When using Mojang authentication it is not necessary to load this info, as it will be automatically loaded.

func (*MCaccount) MicrosoftAuthenticate

func (account *MCaccount) MicrosoftAuthenticate() error

func (*MCaccount) MojangAuthenticate

func (account *MCaccount) MojangAuthenticate() error

Runs all steps necessary to have a fully authenticated mojang account. It will submit email & pass and securitty questions (if necessary).

func (*MCaccount) NameChangeInfo

func (account *MCaccount) NameChangeInfo() (nameChangeInfoResponse, error)

grab information on the availability of name change for this account

type NameChangeReturn added in v0.1.8

type NameChangeReturn struct {
	Account     MCaccount
	Username    string
	ChangedName bool
	StatusCode  int
	SendTime    time.Time
	ReceiveTime time.Time
}

type RequestError added in v0.1.5

type RequestError struct {
	StatusCode int
	Err        error
}

TODO: Use RequestError for status-code-related errors

func (*RequestError) Error added in v0.1.5

func (r *RequestError) Error() string

type SqAnswer

type SqAnswer struct {
	Answer struct {
		ID int `json:"id"`
	} `json:"answer"`
	Question struct {
		ID       int    `json:"id"`
		Question string `json:"question"`
	} `json:"question"`
}

type XBLSignInResp

type XBLSignInResp struct {
	Issueinstant  time.Time `json:"IssueInstant"`
	Notafter      time.Time `json:"NotAfter"`
	Token         string    `json:"Token"`
	Displayclaims struct {
		Xui []struct {
			Uhs string `json:"uhs"`
		} `json:"xui"`
	} `json:"DisplayClaims"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL