utils

package
v1.6.0-pre1.0...-908290d Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Rng = rand.New(src)

Functions

func Contains

func Contains(slice []string, item string) bool

func DownloadUpdate

func DownloadUpdate() error

func EmitEventIfNotCLI

func EmitEventIfNotCLI(eventName string, args ...interface{})

func FormatNumber

func FormatNumber(amount int, decimalPlaces int) string

func GetAccountNumber

func GetAccountNumber(token string) string

func GetConfigPath

func GetConfigPath() string

func GetMaxPriority

func GetMaxPriority(buttonPriority map[int]int) int

func GetUserAgent

func GetUserAgent() string

func Log

func Log(level LogLevel, logType LogType, username string, msg string)

func RandHours

func RandHours(min, max float32) time.Duration

func RandMinutes

func RandMinutes(min, max float32) time.Duration

func RandSeconds

func RandSeconds(min, max float32) time.Duration

func ReadConfig

func ReadConfig() (config.Config, error)

func RunUpdater

func RunUpdater(updaterTempPath string, newBinaryTempPath string) error

func SetCliMode

func SetCliMode(checker func() bool)

func ShowErrorDialog

func ShowErrorDialog(title, message string)

func Sleep

func Sleep(duration time.Duration) <-chan bool

Types

type ApiResponse

type ApiResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

func MakeAPIRequest

func MakeAPIRequest(url string, headers map[string]string) (*ApiResponse, error)

type Change

type Change struct {
	Version   string   `json:"version"`
	Changelog []string `json:"changelog"`
}

func CheckForUpdates

func CheckForUpdates(currentVersion string) (string, []Change)

type LogLevel

type LogLevel string
const (
	Important LogLevel = "important"
	Others    LogLevel = "others"
	Discord   LogLevel = "discord"
)

type LogType

type LogType string
const (
	Info  LogType = "INF"
	Error LogType = "ERR"
)

type ProgressReader

type ProgressReader struct {
	// contains filtered or unexported fields
}

func NewProgressReader

func NewProgressReader(r io.Reader, total int64, callback func(int)) *ProgressReader

func (*ProgressReader) Read

func (pr *ProgressReader) Read(p []byte) (int, error)

type VersionResponse

type VersionResponse struct {
	Version string   `json:"version"`
	Changes []Change `json:"changes"`
}

Jump to

Keyboard shortcuts

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