Documentation ¶
Index ¶
- func ConvertColorToInt32(c color.RGBA) int32
- func ExtractNode(content string, fn extractNodeCondition) (*html.Node, error)
- func ExtractNodeText(n *html.Node, buf *bytes.Buffer)
- func FormattedNum(num int64) string
- func FormattedTime(secondsIn int64) string
- func FormattedUserTag(u discord.User) string
- func GetUserMention(id int64) string
- func HeadLinesLimit(s string, limit int) string
- func JoinInt64AndStr(int int64, str string) string
- func JoinInt64Slice(i []int64, sep string, prefix string, suffix string) string
- func JoinIntAndStr(int int, str string) string
- func LogPanic()
- func NewInterface(typ reflect.Type, data []byte) (interface{}, error)
- func ParseHexColorFast(s string) (c color.RGBA, err error)
- func RegisterHttpBashRequests()
- func RequestUrl(url string, method string) ([]byte, *http.Response, error)
- func RequestUrlFn(url string, method string, fn func(req *http.Request)) ([]byte, *http.Response, error)
- func RequestUrlReq(req *http.Request) ([]byte, *http.Response, error)
- func RequestUrlRetry(urls []string, method string, code int) (bytes []byte)
- func RetryFunc(fn retryFunction, n int, delayMs time.Duration) ([]byte, error)
- func SliceContains[T comparable](s []T, e T) bool
- func SliceEqual[T comparable](a []T, b []T) bool
- func SliceJoin[T any](s []T, sep string, c func(s T) *string) string
- func SliceRemove[T comparable](s []T, m T) []T
- func SliceRemoveIndex[T comparable](s []T, i int) []T
- func SliceReverse[S ~[]T, T any](s S)
- func SliceSortAlphanumeric[S ~[]T, T string](s S)
- func SlicesCondition[T comparable](s []T, c func(s T) bool) bool
- func TailLinesLimit(s string, limit int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertColorToInt32 ¶
ConvertColorToInt32 will convert 3 uint8s into one int32
func ExtractNode ¶
ExtractNode will select the first node to match extractNodeCondition, for example res, err := ExtractNode(string(content), func(str string) bool { return str == "title" })
func FormattedNum ¶
FormattedNum will insert commas as necessary in large numbers
func FormattedTime ¶
FormattedTime will turn seconds into a pretty time representation
func FormattedUserTag ¶
FormattedUserTag will return the user#discrim if it's non-0 otherwise just username
func GetUserMention ¶
GetUserMention will return a formatted user mention from an id
func HeadLinesLimit ¶
HeadLinesLimit will take the first amount of lines that fit into the X char limit If the string does not consist of split lines, instead just fit the first amount of chars.
func JoinInt64AndStr ¶
JoinInt64AndStr will join and add a plural s to the str if int is not 1, for example, "0 hours", "1 hour", "2 hours".
func JoinInt64Slice ¶
JoinInt64Slice will join i with sep
func JoinIntAndStr ¶
JoinIntAndStr is a wrapper for JoinInt64AndStr
func ParseHexColorFast ¶
ParseHexColorFast will take a hex string, and convert it to a color.RGBA
func RegisterHttpBashRequests ¶
func RegisterHttpBashRequests()
func RequestUrl ¶
RequestUrl will return the bytes of the body of url
func RequestUrlFn ¶
func RequestUrlFn(url string, method string, fn func(req *http.Request)) ([]byte, *http.Response, error)
RequestUrlFn will execute fn on req, then return the bytes of the body of url
func RequestUrlReq ¶
RequestUrlReq will return the bytes of the body of request
func RequestUrlRetry ¶
RequestUrlRetry will return the bytes of the body of the first successful url
func SliceContains ¶
func SliceContains[T comparable](s []T, e T) bool
SliceContains will return if slice s contains e
func SliceEqual ¶
func SliceEqual[T comparable](a []T, b []T) bool
SliceEqual returns true if all bytes of a and b are the same
func SliceRemoveIndex ¶
func SliceRemoveIndex[T comparable](s []T, i int) []T
SliceRemoveIndex will remove index i from s
func SliceSortAlphanumeric ¶
func SliceSortAlphanumeric[S ~[]T, T string](s S)
SliceSortAlphanumeric will sort a string slice alphanumerically
func SlicesCondition ¶
func SlicesCondition[T comparable](s []T, c func(s T) bool) bool
SlicesCondition will return if all values of []T match condition c
func TailLinesLimit ¶
TailLinesLimit will take the last amount of lines that fit into the X char limit. If the string does not consist of split lines, instead just fit the last amount of chars.
Types ¶
This section is empty.