helpers

package
v0.0.0-...-cdb1537 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtRole

func AtRole(role string) string

AtRole returns a string that mentions a role

func AtUser

func AtUser(user string) string

AtUser returns a string that mentions a user

func BuildOBIII

func BuildOBIII() error

BuildOBIII builds the OBIII binary

func Choose

func Choose[T any](slice []T) T

Choose returns a random item from a slice

func Contains

func Contains[T comparable](slice []T, item T) bool

Contains returns true if a slice contains an item

func EliminationPool

func EliminationPool[T comparable](round map[T]int, options []T) []T

EmliminationPool returns the options with the lowest count in a round

func Exit

func Exit() error

Exit restarts the OBIII service

func IndexOf

func IndexOf[T comparable](slice []T, item T) int

IndexOf returns the index of an item in a slice

func IsEmpty

func IsEmpty[T any](slice []T) bool

IsEmpty returns true if a slice is empty

func IsNotEmpty

func IsNotEmpty[T any](slice []T) bool

IsNotEmpty returns true if a slice is not empty

func IsUnique

func IsUnique[T comparable](slice []T) bool

IsUnique returns true if all items in a slice are unique

func JumpURL

func JumpURL(m *discordgo.Message) string

JumpURL returns the URL to jump to a message

func JumpURLByID

func JumpURLByID(channelID, messageID string) string

JumpURLByID returns the URL to jump to a message

func Remove

func Remove[T comparable](slice []T, item T) []T

Remove removes an item from a slice

func SelectButtons

func SelectButtons(s *discordgo.Session, i *discordgo.InteractionCreate, componentHandlers *map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate), ctx ddtrace.SpanContext, message string, options ...string) (string, *discordgo.InteractionCreate, error)

SelectButtons sends a message with buttons to select from

func SelectButtonsEdit

func SelectButtonsEdit(s *discordgo.Session, i *discordgo.InteractionCreate, componentHandlers *map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate), ctx ddtrace.SpanContext, message string, options ...string) (string, error)

SelectButtonsEdit edits a message with buttons to select from

func SendDirectMessage

func SendDirectMessage(s *discordgo.Session, userID string, message string, ctx ddtrace.SpanContext) error

SendDirectMessage sends a direct message to a user

func SendDirectMessageWithFile

func SendDirectMessageWithFile(s *discordgo.Session, userID string, message string, file string, ctx ddtrace.SpanContext) error

SendDirectMessageWithFile sends a direct message to a user with a file

func UpdateMainBranch

func UpdateMainBranch() (bool, error)

UpdateMainBranch switches to the main branch, fetches from origin, pulls from origin, and returns true if an update was pulled

Types

This section is empty.

Jump to

Keyboard shortcuts

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