twitch-bot/internal/template/numeric/numeric.go
Knut Ahlers c78356f68f
Lint: Update linter config, improve code quality
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-01-01 17:52:39 +01:00

22 lines
637 B
Go

// Package numeric contains helpers for numeric manipulation
package numeric
import (
"math"
"github.com/Luzifer/twitch-bot/v3/plugins"
)
// Register provides the plugins.RegisterFunc
func Register(args plugins.RegistrationArguments) error {
args.RegisterTemplateFunction("pow", plugins.GenericTemplateFunctionGetter(math.Pow), plugins.TemplateFuncDocumentation{
Description: "Returns float from calculation: `float1 ** float2`",
Syntax: "pow <float1> <float2>",
Example: &plugins.TemplateFuncDocumentationExample{
Template: `{{ printf "%.0f" (pow 10 4) }}`,
ExpectedOutput: "10000",
},
})
return nil
}