Documentation ¶
Index ¶
- Variables
- func AppendUnique(list []string, s string) []string
- func BuildChannelTag(cid string) string
- func BuildUserTag(uid string) string
- func Contains(list []string, s string) bool
- func CreationTime(ID string) (t time.Time, err error)
- func Index(list []string, s string) int
- func IsUserInServer(s *DG.Session, gid, uid string) bool
- func IsValidChannel(s *DG.Session, gid, cid string) bool
- func Max(arr []int) int
- func MemberName(m *DG.Member) string
- func Remove(list []string, s string) []string
- func StripChannelTag(cid string) (string, bool)
- func StripUserTag(uid string) (string, bool)
- func Timestamp(t time.Time) string
- func ToHashMap[T comparable](arr []T) map[T]bool
- func ToSlice[T any](dict map[string]T) []T
- type RNG
Constants ¶
This section is empty.
Variables ¶
var ChannelTagPattern = regexp.MustCompile("<#([0-9]{18})>")
var UserTagPattern = regexp.MustCompile("<@!([0-9]{18})>")
Functions ¶
func AppendUnique ¶
func BuildChannelTag ¶
Returns the discord channel tag for channel with ID cid
func BuildUserTag ¶
Returns the discord user tag for user with ID uid
func CreationTime ¶
CreationTime returns the creation time of a Snowflake ID relative to the creation of Discord. Taken from https://github.com/Moonlington/FloSelfbot/blob/master/commands/commandutils.go#L117
func IsUserInServer ¶
Return true if the user uid is a member of the server gid
func IsValidChannel ¶
Return true if cid is a valid channel in the guild identifed by gid
func MemberName ¶
func StripChannelTag ¶
Return true and the channel ID if the input string matched the channel tag format
func StripUserTag ¶
Return true and the user ID if the input string matched the user tag format
func ToHashMap ¶
func ToHashMap[T comparable](arr []T) map[T]bool
Types ¶
type RNG ¶
func (RNG) PercentChance ¶
PercentChance generates a random number generator, and returns true if it is strictly inferior to 100. In other terms, it randomizes a `Rate%` probability.