Archived
1
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
i2_bot/lib/talkers/suggestions.go

60 lines
1.5 KiB
Go
Raw Normal View History

2017-10-13 03:52:04 +04:00
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package talkers
import (
2017-10-18 07:03:34 +04:00
// stdlib
"log"
"strconv"
// 3rd party
"github.com/go-telegram-bot-api/telegram-bot-api"
// local
"../dbmapping"
2017-10-13 03:52:04 +04:00
)
// BestPokememesList shows list for catching based on player league and grade
func (t *Talkers) BestPokememesList(update tgbotapi.Update, playerRaw dbmapping.Player) string {
pokememes, ok := c.Getters.GetBestPokememes(playerRaw.ID)
2017-10-18 07:03:34 +04:00
if !ok {
log.Printf("Cannot get pokememes from getter!")
return "fail"
}
2017-10-13 03:52:04 +04:00
2017-10-18 07:03:34 +04:00
message := "*Лучшие покемемы для ловли*\n\n"
for i := range pokememes {
pk := pokememes[i].Pokememe
pkL := pokememes[i].Locations
pkE := pokememes[i].Elements
2017-10-18 07:03:34 +04:00
message += strconv.Itoa(pk.Grade) + "⃣ "
message += pk.Name + " (⚔"
message += c.Parsers.ReturnPoints(pk.Attack)
message += ", 🛡" + c.Parsers.ReturnPoints(pk.Defence) + ")"
for i := range pkE {
message += pkE[i].Symbol
2017-10-18 07:03:34 +04:00
}
message += " /pk" + strconv.Itoa(pk.ID) + "\n"
2017-10-18 07:03:34 +04:00
message += "Локации: "
for i := range pkL {
message += pkL[i].Symbol + pkL[i].Name
if i+1 < len(pkL) {
2017-10-18 07:03:34 +04:00
message += ", "
}
}
message += "\nКупить: "
if pk.Purchaseable {
message += "💲" + c.Parsers.ReturnPoints(pk.Price*3)
} else {
message += "Нельзя"
}
message += "\n\n"
}
2017-10-13 03:52:04 +04:00
2017-10-18 07:03:34 +04:00
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
msg.ParseMode = "Markdown"
2017-10-13 03:52:04 +04:00
2017-10-18 07:03:34 +04:00
c.Bot.Send(msg)
2017-10-13 03:52:04 +04:00
2017-10-18 07:03:34 +04:00
return "ok"
2017-10-13 03:52:04 +04:00
}