2018-01-29 23:50:25 +04:00
|
|
|
|
// i2_bot – Instinct PokememBro Bot
|
|
|
|
|
// Copyright (c) 2018 Vladimir "fat0troll" Hodakov
|
|
|
|
|
|
|
|
|
|
package datacacheinterface
|
|
|
|
|
|
|
|
|
|
import (
|
2018-02-17 07:03:58 +04:00
|
|
|
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
2018-02-13 22:05:32 +04:00
|
|
|
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
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)
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
AddPokememe(pokememeData map[string]string, pokememeLocations map[string]string, pokememeElements map[string]string) (int, error)
|
|
|
|
|
GetAllPokememes() map[int]*dbmapping.PokememeFull
|
|
|
|
|
GetPokememeByID(pokememeID int) (*dbmapping.PokememeFull, error)
|
|
|
|
|
GetPokememeByName(name string) (*dbmapping.PokememeFull, error)
|
|
|
|
|
DeletePokememeByID(pokememeID int) error
|
2018-02-14 00:09:58 +04:00
|
|
|
|
UpdatePokememe(pokememeData map[string]string, pokememeLocations map[string]string, pokememeElements map[string]string) (int, error)
|
2018-01-29 23:50:25 +04:00
|
|
|
|
|
|
|
|
|
GetLeagueBySymbol(symbol string) (*dbmapping.League, error)
|
2018-02-07 15:59:28 +04:00
|
|
|
|
|
|
|
|
|
GetWeaponTypeByID(weaponID int) (*dbmapping.Weapon, error)
|
2018-01-29 23:50:25 +04:00
|
|
|
|
GetWeaponTypeByName(name string) (*dbmapping.Weapon, error)
|
|
|
|
|
}
|