util

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const InteractionEvtType = "interaction"
View Source
const MessageEvtType = "message"
View Source
const ReactionEvtType = "reaction"

Variables

This section is empty.

Functions

func CheckCtxTimeout added in v1.2.0

func CheckCtxTimeout(ctx context.Context) error

func ContextFromDiscordInteractionCreate added in v1.2.0

func ContextFromDiscordInteractionCreate(parent context.Context, i *discordgo.InteractionCreate, timeout time.Duration) (context.Context, context.CancelFunc)

func ContextFromDiscordMessageCreate added in v1.2.0

func ContextFromDiscordMessageCreate(parent context.Context, m *discordgo.MessageCreate) context.Context

func ContextFromDiscordReactionAdd added in v1.6.0

func ContextFromDiscordReactionAdd(parent context.Context, r *discordgo.MessageReactionAdd) context.Context

func ContextFromListenConfig added in v1.2.0

func ContextFromListenConfig(parent context.Context, guildId, channelId string) context.Context

func GetLastMonth added in v1.2.0

func GetLastMonth(now time.Time) string

GetLastMonth gets the string for the previous month in YYYY-MM format

func Healthcheck added in v1.2.0

func Healthcheck(w http.ResponseWriter, _ *http.Request)

func IntSliceToStr

func IntSliceToStr(in []int) []string

func PreprocessRoll added in v1.4.0

func PreprocessRoll(input string) string

PreprocessRoll handles preprocessing roll data from user input. Currently, this converts "d20" -> "1d20" for common shorthand

Example
s := PreprocessRoll("d20 + d8 + 1d4")
fmt.Println(s)
Output:

1d20 + 1d8 + 1d4

Types

This section is empty.

Jump to

Keyboard shortcuts

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