From 0aa26c1cfa40444cb2def8a366b1e87792802138 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Wed, 29 Nov 2017 18:54:13 +0400 Subject: [PATCH] Latest bugfixes and updates --- lib/router/group_request.go | 2 +- lib/router/private_request.go | 2 +- lib/welcomer/welcomer.go | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/router/group_request.go b/lib/router/group_request.go index 0c4f327..a38956c 100644 --- a/lib/router/group_request.go +++ b/lib/router/group_request.go @@ -15,7 +15,7 @@ func (r *Router) routeGroupRequest(update *tgbotapi.Update, playerRaw *dbmapping // Regular expressions var durakMsg = regexp.MustCompile("(Д|д)(У|у)(Р|р)(А|а|Е|е|О|о)") var huMsg = regexp.MustCompile("(Х|х)(У|у)(Й|й|Я|я|Ю|ю|Е|е)") - var blMsg = regexp.MustCompile("(\\s|^)(Б|б)(Л|л)((Я|я)(Т|т|Д|д)|)") + var blMsg = regexp.MustCompile("(\\s|^)(Б|б)(Л|л)((Я|я)(Т|т|Д|д))") var ebMsg = regexp.MustCompile("(\\s|^|ЗА|За|зА|за)(Е|е|Ё|ё)(Б|б)(\\s|Л|л|А|а|Т|т|У|у|Е|е|Ё|ё|И|и)") var piMsg = regexp.MustCompile("(П|п)(И|и)(З|з)(Д|д)") diff --git a/lib/router/private_request.go b/lib/router/private_request.go index 1b41d2d..0d7def1 100644 --- a/lib/router/private_request.go +++ b/lib/router/private_request.go @@ -15,7 +15,7 @@ func (r *Router) routePrivateRequest(update *tgbotapi.Update, playerRaw *dbmappi // Commands with regexps var pokedexMsg = regexp.MustCompile("/pokede(x|ks)\\d?\\z") var pokememeInfoMsg = regexp.MustCompile("/pk(\\d+)") - var usersMsg = regexp.MustCompile("/users\\d?\\z") + var usersMsg = regexp.MustCompile("/users(\\d+|)\\z") var squadInfoMsg = regexp.MustCompile("/show_squad(\\d+)\\z") var orderSendMsg = regexp.MustCompile("/send_order(\\d+)\\z") diff --git a/lib/welcomer/welcomer.go b/lib/welcomer/welcomer.go index f00e30d..748185a 100644 --- a/lib/welcomer/welcomer.go +++ b/lib/welcomer/welcomer.go @@ -16,8 +16,18 @@ func (w *Welcomer) groupWelcomeUser(update *tgbotapi.Update, newUser *tgbotapi.U _, profileExist := c.Users.GetProfile(playerRaw.ID) + userName := "" + if newUser.UserName != "" { + userName += "@" + newUser.UserName + } else { + userName += newUser.FirstName + if newUser.LastName != "" { + userName += " " + newUser.LastName + } + } + message := "*Бот Инстинкта приветствует тебя, *@" - message += c.Users.FormatUsername(newUser.UserName) + message += c.Users.FormatUsername(userName) message += "*!*\n\n" if profileExist {