utils

package
v0.0.0-...-ec0d61c Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClampInt

func ClampInt(num int, min int, max int) int

ClampInt clamps int

func GetStringVal

func GetStringVal(str string, notSet string) string

GetStringVal if string str is not set it returns var notSet, if its set it returns var str

func IsMention

func IsMention(str string) bool

IsMention returns whether given string is mention <@...>/<@!...>

func IsNSFW

func IsNSFW(session *discordgo.Session, channelID string) bool

IsNSFW returns whether channel with given channelID has enabled NSFW

func IsNumber

func IsNumber(str string) bool

IsNumber returns whether given string is number

func Matches

func Matches(str string, str2 string, caseSensitive bool) bool

Matches returns whether string matches second string

func MatchesPrefix

func MatchesPrefix(str string, prefix string, caseSensitive bool) bool

MatchesPrefix returns whether string has prefix

func MentionToID

func MentionToID(mention string) string

MentionToID converts mention <@...> thing to user ID

func RandomStringElement

func RandomStringElement(array []string) string

RandomStringElement Returns random element from string array

func StringToInt

func StringToInt(str string) int

StringToInt converts string to int, if its invalid returns -1

Types

This section is empty.

Jump to

Keyboard shortcuts

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