utils

package
v0.0.0-...-38c0829 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanTrigger

func CanTrigger(currentUserName string, currentUserID string, rule models.Rule, bot *models.Bot) bool

CanTrigger ensures the user is allowed to use the respective rule.

func ExecArgTokenizer

func ExecArgTokenizer(stripped string) []string

ExecArgTokenizer goes through a string and tokenizes as parameters for use when executing a script (respecting empty arguments).

func GetRoomIDs

func GetRoomIDs(wantRooms []string, bot *models.Bot) []string

GetRoomIDs helps find a room by name, if we have 'cached' it.

func IsSet

func IsSet(s ...string) bool

IsSet is a helper function to check whether any of the supplied strings are empty or unsubstituted (ie. still in ${<string>} format).

func MakeNiceJSON

func MakeNiceJSON(in map[string]any) map[string]any

MakeNiceJSON exists to address https://github.com/go-yaml/yaml/issues/139

func Match

func Match(pattern, value string, trimValue bool) (string, bool)

Match checks given value against given pattern.

func RuleArgTokenizer

func RuleArgTokenizer(stripped string) []string

RuleArgTokenizer goes through a string and tokenizes as parameters for use when identifying rules to be triggered (ignoring empty arguments).

func Substitute

func Substitute(value string, tokens map[string]string) (string, error)

Substitute checks given value for variables and looks them up to determine whether we have a matching replacement available, either in the supplied map, or from environment variables.

Types

This section is empty.

Jump to

Keyboard shortcuts

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