Fix unsplash usage detection

This commit is contained in:
Hamcha 2016-06-21 17:51:11 +02:00
parent 2356f23f03
commit 20281a6113

View file

@ -52,7 +52,9 @@ func unsplash(broker *tg.Broker, update tg.APIMessage) {
text = *(update.ReplyTo.Text) text = *(update.ReplyTo.Text)
user = update.ReplyTo.User user = update.ReplyTo.User
} else { } else {
text = strings.TrimSpace(strings.Replace(*(update.Text), "/unsplash", "", 1)) if strings.Index(text, " ") > 0 {
text = strings.TrimSpace(strings.SplitN(*(update.Text), " ", 2)[1])
}
} }
author := user.FirstName author := user.FirstName