mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-30 00:21:16 +00:00
17 lines
328 B
Go
17 lines
328 B
Go
|
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
|
||
|
}))
|
||
|
}
|