From 20281a61135a330e392279394f68304ef5c61131 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Tue, 21 Jun 2016 17:51:11 +0200 Subject: [PATCH] Fix unsplash usage detection --- mods/unsplash.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/unsplash.go b/mods/unsplash.go index f0a1158..c449bb6 100644 --- a/mods/unsplash.go +++ b/mods/unsplash.go @@ -52,7 +52,9 @@ func unsplash(broker *tg.Broker, update tg.APIMessage) { text = *(update.ReplyTo.Text) user = update.ReplyTo.User } 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