utils

package
v0.0.0-...-2cb72f2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldsN

func FieldsN(s string, n int) []string

Splits a string using FieldsFunc and a function that will only split n number of times

func FormatUserList

func FormatUserList(userList []string) string

Formats a list of discord users

func IsSenderInRole

func IsSenderInRole(session *discordgo.Session, message *discordgo.MessageCreate, role string) bool

Checks if a sender of a message is in a given role.

func IsUserInRole

func IsUserInRole(session *discordgo.Session, guildID, userID, role string) bool

Checks if a user is in a specific role.

func RandomString

func RandomString(length int) string

Returns a random string of letters of a given length.

func ReadFromUrl

func ReadFromUrl(url string) (string, error)

Reads from a URL.

func StringSliceContains

func StringSliceContains(slice []string, string string) bool

Checks if a slice of strings contains a given string

func StringSliceEquals

func StringSliceEquals(s1, s2 []string) bool

Checks if two string slices have equal contents

func StringSliceIndexOf

func StringSliceIndexOf(element string, slice []string) int

Gets the index of a string in a slice

func Substring

func Substring(s string, start, end int) string

Returns the substring of a string, cut from the start index to the end index.

Types

type Emailer

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

func NewEmailer

func NewEmailer(config *cfg.Config) (*Emailer, error)

Creates a new emailer.

func (*Emailer) IsValidEmail

func (emailer *Emailer) IsValidEmail(email string) bool

Checks if an email is within the list of valid emails.

func (*Emailer) SendVerificationEmail

func (emailer *Emailer) SendVerificationEmail(to, subject, prefix, code string)

Sends an email to an address

Jump to

Keyboard shortcuts

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