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

56 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package talkers
import (
"github.com/go-telegram-bot-api/telegram-bot-api"
"lab.pztrn.name/fat0troll/i2_bot/lib/dbmapping"
"strconv"
)
// 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)
if !ok {
c.Log.Error("Cannot get pokememes from getter!")
return "fail"
}
message := "*Лучшие покемемы для ловли*\n\n"
for i := range pokememes {
pk := pokememes[i].Pokememe
pkL := pokememes[i].Locations
pkE := pokememes[i].Elements
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
}
message += " /pk" + strconv.Itoa(pk.ID) + "\n"
message += "Локации: "
for i := range pkL {
message += pkL[i].Symbol + pkL[i].Name
if i+1 < len(pkL) {
message += ", "
}
}
message += "\nКупить: "
if pk.Purchaseable {
message += "💲" + c.Parsers.ReturnPoints(pk.Price*3)
} else {
message += "Нельзя"
}
message += "\n\n"
}
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
msg.ParseMode = "Markdown"
c.Bot.Send(msg)
return "ok"
}