util

package
v0.0.0-...-ba096a2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

General utility functions for moebot.

If there are any imports in this package that aren't part of the standard libary (or a /x/ or golang repoo) then that's a signal to move to a more specific package within util such as event or moeDiscord.

Index

Constants

View Source
const (
	CaseInsensitive = iota
	CaseSensitive
)

Variables

This section is empty.

Functions

func ExtractChannelIdFromString

func ExtractChannelIdFromString(message string) (id string, valid bool)

func ForceTitleCase

func ForceTitleCase(s string) string

Forces title case for the given string. This is necessary when your string may contain upper case characters

func GetInt64OrDefault

func GetInt64OrDefault(i sql.NullInt64) int64

func GetStringOrDefault

func GetStringOrDefault(s sql.NullString) string

func IntContains

func IntContains(s []int, e int) bool

func IntIndexOf

func IntIndexOf(s []int, e int) int

func IntRemove

func IntRemove(s []int, e int) []int

func MakeAlphaOnly

func MakeAlphaOnly(s string) string

func MakeGif

func MakeGif(text string) []byte

func MakeStringBold

func MakeStringBold(s string) string

func MakeStringCode

func MakeStringCode(s string) string

func MakeStringItalic

func MakeStringItalic(s string) string

func MakeStringStrikethrough

func MakeStringStrikethrough(s string) string

func NormalizeNewlines

func NormalizeNewlines(s string) string

func ParseIntervalToISO

func ParseIntervalToISO(interval string) (string, error)

func StrContains

func StrContains(s []string, e string, caseInsensitive int) bool

func StrContainsPrefix

func StrContainsPrefix(s []string, e string, caseInsensitive int) bool

func StringIndexOf

func StringIndexOf(s []string, search string) int

func Subtract

func Subtract(slice1 []int, slice2 []int) []int

Subtract removes all values in slice2 from slice1

func UserIdToMention

func UserIdToMention(userId string) string

Converts a user's ID into a mention. This is useful when you don't have a User object, but want to mention them

Types

type SyncCooldownMap

type SyncCooldownMap struct {
	sync.RWMutex
	M map[string]int64
}

type SyncUIDByChannelMap

type SyncUIDByChannelMap struct {
	sync.RWMutex
	M map[string][]string
}

Directories

Path Synopsis
db
All database interactions and database tables within moebot's database
All database interactions and database tables within moebot's database
Processing and type definitions for events within moebot.
Processing and type definitions for events within moebot.
Extensions and additions to discordGo.
Extensions and additions to discordGo.
Processing and retrieving information from reddit's API
Processing and retrieving information from reddit's API

Jump to

Keyboard shortcuts

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