From 00254936363664edef25c7bfb5b0598ca1c213a3 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sun, 26 Nov 2017 15:45:55 +0400 Subject: [PATCH] Bot welcome message fix for self-welcomes --- lib/welcomer/responders.go | 10 +++++----- lib/welcomer/welcomer.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/welcomer/responders.go b/lib/welcomer/responders.go index aa703d3..0d22b8d 100644 --- a/lib/welcomer/responders.go +++ b/lib/welcomer/responders.go @@ -47,12 +47,12 @@ func (w *Welcomer) PrivateWelcomeMessageSpecial(update *tgbotapi.Update, playerR func (w *Welcomer) GroupWelcomeMessage(update *tgbotapi.Update) string { newUsers := *update.Message.NewChatMembers for i := range newUsers { - if (newUsers[i].UserName == "i2_bot") || (newUsers[i].UserName == "i2_dev_bot") { - w.groupStartMessage(update) - } - newUser := newUsers[i] - w.groupWelcomeUser(update, &newUser) + if (newUser.UserName == "i2_bot") || (newUser.UserName == "i2_dev_bot") { + w.groupStartMessage(update) + } else { + w.groupWelcomeUser(update, &newUser) + } } return "ok" diff --git a/lib/welcomer/welcomer.go b/lib/welcomer/welcomer.go index 9481ec3..80b9acd 100644 --- a/lib/welcomer/welcomer.go +++ b/lib/welcomer/welcomer.go @@ -17,7 +17,7 @@ func (w *Welcomer) groupWelcomeUser(update *tgbotapi.Update, newUser *tgbotapi.U profileRaw, profileExist := c.Users.GetProfile(playerRaw.ID) message := "*Бот Инстинкта приветствует тебя, *@" - message += newUser.UserName + message += c.Users.FormatUsername(newUser.UserName) message += "*!*\n\n" if profileExist { @@ -54,4 +54,4 @@ func (w *Welcomer) groupStartMessage(update *tgbotapi.Update) string { c.Bot.Send(msg) return "ok" -} \ No newline at end of file +}