Archived
1

Database connections, refactoring, pokememe parsing in progress

This commit is contained in:
Vladimir Hodakov
2017-10-06 02:56:06 +04:00
parent 4fec8f0fe7
commit fe496d696f
29 changed files with 842 additions and 18 deletions

19
lib/talkers/errors.go Normal file
View File

@@ -0,0 +1,19 @@
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package talkers
import (
// 3rd party
"gopkg.in/telegram-bot-api.v4"
)
func AnyMessageUnauthorized(bot *tgbotapi.BotAPI, update tgbotapi.Update) {
error_message := "Извини, действие для тебя недоступно. Возможно, у меня нет твоего профиля или же твои права недостаточны для совершения данного действия\n\n"
error_message += "Если тебе кажется, что это ошибка, пиши @fat0troll.\n"
msg := tgbotapi.NewMessage(update.Message.Chat.ID, error_message)
msg.ParseMode = "Markdown"
bot.Send(msg)
}

32
lib/talkers/hello.go Normal file
View File

@@ -0,0 +1,32 @@
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package talkers
import (
// 3rd party
"gopkg.in/telegram-bot-api.v4"
// local
"../dbmappings"
)
func HelloMessageUnauthorized(bot *tgbotapi.BotAPI, update tgbotapi.Update) {
hello_message := "*Бот Инстинкта приветствует тебя!*\n\n"
hello_message += "Для начала работы с ботом, пожалуйста, перешли от бота игры @PokememBroBot профиль героя.\n"
hello_message += "Все дальнейшие действия с ботом возможны лишь при наличии профиля игрока."
msg := tgbotapi.NewMessage(update.Message.Chat.ID, hello_message)
msg.ParseMode = "Markdown"
bot.Send(msg)
}
func HelloMessageAuthorized(bot *tgbotapi.BotAPI, update tgbotapi.Update, player_raw dbmappings.Players) {
hello_message := "*Бот Инстинкта приветствует тебя. Снова.*\n\n"
hello_message += "Привет, " + update.Message.From.FirstName + " " + update.Message.From.LastName + "!\n"
hello_message += "Последнее обновление информации о тебе: " + player_raw.Updated_at.Format("02.01.2006 15:04:05 -0700")
msg := tgbotapi.NewMessage(update.Message.Chat.ID, hello_message)
msg.ParseMode = "Markdown"
bot.Send(msg)
}

View File

@@ -11,7 +11,7 @@ import (
)
func HelpMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update) {
help_message := "*Бот Инстинкта. Версия обезшпионенная и улучшенная.*\n\n"
help_message := "*Бот Инстинкта Enchanched.*\n\n"
help_message += "Текущая версия: *" + config.VERSION + "*\n\n"
help_message += "Список команд:\n\n"
help_message += "+ /help выводит данное сообщение\n"