1
0
Fork 0
mirror of https://github.com/Luzifer/twitch-bot.git synced 2025-03-16 03:35:59 +00:00

Fix: Use fallback on empty display name

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-05-24 21:47:10 +02:00
parent 487bce25d7
commit 7bb9e2869d
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -7,7 +7,7 @@ import (
func init() {
tplFuncs.Register("displayName", genericTemplateFunctionGetter(func(username string, v ...string) (string, error) {
displayName, err := twitch.GetDisplayNameForUser(strings.TrimLeft(username, "#"))
if err != nil && len(v) > 0 {
if len(v) > 0 && (err != nil || displayName == "") {
return v[0], nil
}