twitch-bot/functions_twitch.go

17 lines
328 B
Go
Raw Permalink Normal View History

package main
import (
"strings"
)
func init() {
tplFuncs.Register("recentGame", genericTemplateFunctionGetter(func(username string, v ...string) (string, error) {
game, _, err := twitch.GetRecentStreamInfo(strings.TrimLeft(username, "#"))
if err != nil && len(v) > 0 {
return v[0], nil
}
return game, err
}))
}