2018-01-29 23:50:25 +04:00
|
|
|
|
// i2_bot – Instinct PokememBro Bot
|
|
|
|
|
// Copyright (c) 2018 Vladimir "fat0troll" Hodakov
|
|
|
|
|
|
|
|
|
|
package datacacheinterface
|
|
|
|
|
|
|
|
|
|
import (
|
2018-05-19 12:14:25 +04:00
|
|
|
|
"github.com/fat0troll/i2_bot/lib/datamapping"
|
|
|
|
|
"github.com/fat0troll/i2_bot/lib/dbmapping"
|
2018-05-19 13:11:56 +04:00
|
|
|
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
2018-01-29 23:50:25 +04:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// DataCacheInterface implements DataCache for importing via appcontext.
|
|
|
|
|
type DataCacheInterface interface {
|
|
|
|
|
Init()
|
|
|
|
|
|
2018-02-17 07:03:58 +04:00
|
|
|
|
GetAllGroupChats() []dbmapping.Chat
|
|
|
|
|
GetAllPrivateChats() []dbmapping.Chat
|
|
|
|
|
GetChatByID(chatID int) (*dbmapping.Chat, error)
|
|
|
|
|
GetOrCreateChat(update *tgbotapi.Update) (*dbmapping.Chat, error)
|
|
|
|
|
GetGroupChatsByIDs(chatIDs []int) []dbmapping.Chat
|
|
|
|
|
GetLeaguePrivateChats() []dbmapping.Chat
|
2018-02-17 16:01:05 +04:00
|
|
|
|
UpdateChatTitle(chatID int, newTitle string) (*dbmapping.Chat, error)
|
2018-02-17 07:03:58 +04:00
|
|
|
|
|
|
|
|
|
AddPlayerToSquad(relation *dbmapping.SquadPlayer) (int, error)
|
2018-02-17 17:19:50 +04:00
|
|
|
|
GetAllSquadMembers(squadID int) []dbmapping.SquadPlayerFull
|
2018-02-17 07:03:58 +04:00
|
|
|
|
GetAllSquadsChats() []dbmapping.Chat
|
|
|
|
|
GetAllSquadsWithChats() []dbmapping.SquadChat
|
|
|
|
|
GetAvailableSquadsChatsForUser(userID int) []dbmapping.Chat
|
|
|
|
|
GetCommandersForSquad(squadID int) []dbmapping.Player
|
|
|
|
|
GetSquadByID(squadID int) (*dbmapping.SquadChat, error)
|
|
|
|
|
GetSquadByChatID(chatID int) (*dbmapping.Squad, error)
|
|
|
|
|
GetSquadsChatsBySquadsIDs(squadsIDs []int) []dbmapping.Chat
|
|
|
|
|
GetUserRoleInSquad(squadID int, playerID int) string
|
|
|
|
|
GetUserRolesInSquads(userID int) []dbmapping.SquadPlayerFull
|
|
|
|
|
|
2018-01-29 23:50:25 +04:00
|
|
|
|
AddPlayer(player *dbmapping.Player) (int, error)
|
2018-05-05 10:33:40 +04:00
|
|
|
|
ChangePlayerKarma(addition int, playerID int) (*dbmapping.Player, error)
|
2018-01-29 23:50:25 +04:00
|
|
|
|
GetOrCreatePlayerByTelegramID(telegramID int) (*dbmapping.Player, error)
|
|
|
|
|
GetPlayerByID(playerID int) (*dbmapping.Player, error)
|
|
|
|
|
GetPlayerByTelegramID(telegramID int) (*dbmapping.Player, error)
|
|
|
|
|
UpdatePlayerFields(player *dbmapping.Player) (*dbmapping.Player, error)
|
|
|
|
|
UpdatePlayerTimestamp(playerID int) error
|
|
|
|
|
|
|
|
|
|
AddProfile(profile *dbmapping.Profile) (int, error)
|
|
|
|
|
GetPlayersWithCurrentProfiles() map[int]*dbmapping.PlayerProfile
|
|
|
|
|
GetProfileByID(profileID int) (*dbmapping.Profile, error)
|
|
|
|
|
GetProfileByPlayerID(playerID int) (*dbmapping.Profile, error)
|
|
|
|
|
|
2018-05-05 10:33:40 +04:00
|
|
|
|
AddTournamentReport(tournamentNumber int, playerID int, target string) (int, error)
|
|
|
|
|
|
2018-03-31 08:34:27 +04:00
|
|
|
|
GetElementByID(elementID int) (*datamapping.Element, error)
|
2018-05-02 00:47:55 +04:00
|
|
|
|
FindElementIDBySymbol(symbol string) (int, error)
|
2018-02-07 15:59:28 +04:00
|
|
|
|
|
2018-03-31 08:34:27 +04:00
|
|
|
|
GetLeagueByID(leagueID int) (*datamapping.League, error)
|
2018-05-19 13:11:56 +04:00
|
|
|
|
GetLeagueByEnglishName(name string) (*datamapping.League, error)
|
2018-05-02 08:48:22 +04:00
|
|
|
|
GetLeagueByName(name string) (*datamapping.League, error)
|
2018-03-31 08:34:27 +04:00
|
|
|
|
GetLeagueBySymbol(symbol string) (*datamapping.League, error)
|
|
|
|
|
|
2018-05-02 00:47:55 +04:00
|
|
|
|
GetLevelByID(levelID int) (*datamapping.Level, error)
|
|
|
|
|
|
|
|
|
|
FindLocationIDByName(name string) (int, error)
|
|
|
|
|
|
|
|
|
|
GetAllPokememes() map[int]*datamapping.PokememeFull
|
|
|
|
|
GetPokememeByID(pokememeID int) (*datamapping.PokememeFull, error)
|
|
|
|
|
GetPokememeByName(name string) (*datamapping.PokememeFull, error)
|
|
|
|
|
GetPokememesCountByGradeAndLocation(grade int, locationID int) int
|
|
|
|
|
|
2018-05-02 08:48:22 +04:00
|
|
|
|
GetWeaponTypeByAttack(attack int) (*datamapping.Weapon, error)
|
2018-03-31 08:34:27 +04:00
|
|
|
|
GetWeaponTypeByID(weaponID int) (*datamapping.Weapon, error)
|
|
|
|
|
GetWeaponTypeByName(name string) (*datamapping.Weapon, error)
|
2018-01-29 23:50:25 +04:00
|
|
|
|
}
|