From 4d941454b5a061587288d2d3c36c7b29c365ab63 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sat, 2 Dec 2017 20:02:27 +0400 Subject: [PATCH] /academy and /bastion: some error messages --- lib/router/private_request.go | 4 +-- lib/talkers/help.go | 28 +++++++++++++++---- .../talkersinterface/talkersinterface.go | 4 +-- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lib/router/private_request.go b/lib/router/private_request.go index 10df8e9..8e4e844 100644 --- a/lib/router/private_request.go +++ b/lib/router/private_request.go @@ -52,10 +52,10 @@ func (r *Router) routePrivateRequest(update *tgbotapi.Update, playerRaw *dbmappi c.Talkers.HelpMessage(update, playerRaw) return "ok" case update.Message.Command() == "academy": - c.Talkers.AcademyMessage(update) + c.Talkers.AcademyMessage(update, playerRaw) return "ok" case update.Message.Command() == "bastion": - c.Talkers.BastionMessage(update) + c.Talkers.BastionMessage(update, playerRaw) return "ok" case pokedexMsg.MatchString(text): diff --git a/lib/talkers/help.go b/lib/talkers/help.go index 88f43a3..adcf045 100644 --- a/lib/talkers/help.go +++ b/lib/talkers/help.go @@ -10,9 +10,17 @@ import ( ) // AcademyMessage gives user link to Bastion -func (t *Talkers) AcademyMessage(update *tgbotapi.Update) { - message := "*Академия Инстинкта*\n" - message += "Чат для обучения новичков предумростям игры расположен по ссылке: https://t.me/joinchat/G2vME04jk02v2etRmumylg" +func (t *Talkers) AcademyMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) { + message := "" + + if playerRaw.LeagueID > 1 { + message = "Иди нахуй, шпионское отродье" + } else if playerRaw.LeagueID == 0 { + message = "Заполни профиль и попробуй ещё раз" + } else { + message += "*Академия Инстинкта*\n" + message += "Чат для обучения новичков предумростям игры расположен по ссылке: https://t.me/joinchat/G2vME04jk02v2etRmumylg" + } msg := tgbotapi.NewMessage(update.Message.Chat.ID, message) msg.ParseMode = "Markdown" @@ -21,9 +29,17 @@ func (t *Talkers) AcademyMessage(update *tgbotapi.Update) { } // BastionMessage gives user link to Bastion -func (t *Talkers) BastionMessage(update *tgbotapi.Update) { - message := "*Бастион Инстинкта*\n" - message += "Общий чат лиги расположен по ссылке: https://t.me/joinchat/G2vME0mIX-QHjjxE\\_JBzoQ" +func (t *Talkers) BastionMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) { + message := "" + + if playerRaw.LeagueID > 1 { + message = "Иди нахуй, шпионское отродье" + } else if playerRaw.LeagueID == 0 { + message = "Заполни профиль и попробуй ещё раз" + } else { + message += "*Бастион Инстинкта*\n" + message += "Общий чат лиги расположен по ссылке: https://t.me/joinchat/G2vME0mIX-QHjjxE\\_JBzoQ" + } msg := tgbotapi.NewMessage(update.Message.Chat.ID, message) msg.ParseMode = "Markdown" diff --git a/lib/talkers/talkersinterface/talkersinterface.go b/lib/talkers/talkersinterface/talkersinterface.go index fb25387..794809b 100644 --- a/lib/talkers/talkersinterface/talkersinterface.go +++ b/lib/talkers/talkersinterface/talkersinterface.go @@ -12,8 +12,8 @@ import ( type TalkersInterface interface { Init() - AcademyMessage(update *tgbotapi.Update) - BastionMessage(update *tgbotapi.Update) + AcademyMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) + BastionMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) HelpMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) AnyMessageUnauthorized(update *tgbotapi.Update) string