tbotapi

package
v0.0.0-...-15b0e05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Start               = 0
	LogIn               = 1
	AboutUs             = 2
	HomePage            = 4
	ViewingProfile      = 5
	ViewingAccountStats = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BattleLog

type BattleLog []struct {
	Type               string `json:"type"`
	BattleTime         string `json:"battleTime"`
	IsLadderTournament bool   `json:"isLadderTournament"`
	Arena              struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"arena"`
	GameMode struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"gameMode"`
	DeckSelection string `json:"deckSelection"`
	Team          []struct {
		Tag              string `json:"tag"`
		Name             string `json:"name"`
		StartingTrophies int    `json:"startingTrophies"`
		TrophyChange     int    `json:"trophyChange"`
		Crowns           int    `json:"crowns"`
		Clan             struct {
			Tag     string `json:"tag"`
			Name    string `json:"name"`
			BadgeID int    `json:"badgeId"`
		} `json:"clan"`
		Cards []struct {
			Name      string `json:"name"`
			ID        int    `json:"id"`
			Level     int    `json:"level"`
			StarLevel int    `json:"starLevel,omitempty"`
			MaxLevel  int    `json:"maxLevel"`
			IconUrls  struct {
				Medium string `json:"medium"`
			} `json:"iconUrls"`
		} `json:"cards"`
	} `json:"team"`
	Opponent []struct {
		Tag                     string `json:"tag"`
		Name                    string `json:"name"`
		StartingTrophies        int    `json:"startingTrophies"`
		TrophyChange            int    `json:"trophyChange"`
		Crowns                  int    `json:"crowns"`
		KingTowerHitPoints      int    `json:"kingTowerHitPoints"`
		PrincessTowersHitPoints []int  `json:"princessTowersHitPoints"`
		Clan                    struct {
			Tag     string `json:"tag"`
			Name    string `json:"name"`
			BadgeID int    `json:"badgeId"`
		} `json:"clan"`
		Cards []struct {
			Name      string `json:"name"`
			ID        int    `json:"id"`
			Level     int    `json:"level"`
			StarLevel int    `json:"starLevel"`
			MaxLevel  int    `json:"maxLevel"`
			IconUrls  struct {
				Medium string `json:"medium"`
			} `json:"iconUrls"`
		} `json:"cards"`
	} `json:"opponent"`
}

func (*BattleLog) GetPlayerStats

func (b *BattleLog) GetPlayerStats(totalWinPercentage float64) string

func (*BattleLog) RecentWinPercentage

func (b *BattleLog) RecentWinPercentage(onlyRankMatches bool) float64

func (*BattleLog) TrophyList

func (b *BattleLog) TrophyList() []int

type Cards

type Cards struct {
	Items []struct {
		Name     string `json:"name"`
		ID       int    `json:"id"`
		MaxLevel int    `json:"maxLevel"`
		IconUrls struct {
			Medium string `json:"medium"`
		} `json:"iconUrls"`
	} `json:"items"`
}

type Clan

type Clan struct {
	MemberList []struct {
		LastSeen        string `json:"lastSeen"`
		ClanChestPoints int    `json:"clanChestPoints"`
		Arena           struct {
			Name struct {
			} `json:"name"`
			ID       int `json:"id"`
			IconUrls struct {
			} `json:"iconUrls"`
		} `json:"arena"`
		Tag               string `json:"tag"`
		Name              string `json:"name"`
		Role              string `json:"role"`
		ExpLevel          int    `json:"expLevel"`
		Trophies          int    `json:"trophies"`
		ClanRank          int    `json:"clanRank"`
		PreviousClanRank  int    `json:"previousClanRank"`
		Donations         int    `json:"donations"`
		DonationsReceived int    `json:"donationsReceived"`
	} `json:"memberList"`
	Tag               string `json:"tag"`
	DonationsPerWeek  int    `json:"donationsPerWeek"`
	ClanChestStatus   string `json:"clanChestStatus"`
	ClanChestLevel    int    `json:"clanChestLevel"`
	BadgeID           int    `json:"badgeId"`
	RequiredTrophies  int    `json:"requiredTrophies"`
	ClanScore         int    `json:"clanScore"`
	ClanChestMaxLevel int    `json:"clanChestMaxLevel"`
	ClanWarTrophies   int    `json:"clanWarTrophies"`
	Name              string `json:"name"`
	Location          struct {
		LocalizedName string `json:"localizedName"`
		ID            int    `json:"id"`
		Name          string `json:"name"`
		IsCountry     bool   `json:"isCountry"`
		CountryCode   string `json:"countryCode"`
	} `json:"location"`
	Type            string `json:"type"`
	Members         int    `json:"members"`
	Description     string `json:"description"`
	ClanChestPoints int    `json:"clanChestPoints"`
	BadgeUrls       struct {
	} `json:"badgeUrls"`
}

type Member

type Member struct {
	State         int
	Tags          []string
	CurrentTag    string
	ChatId        int64
	LastMessageID int
	*tgbotapi.User
}

type MyBotMembers

type MyBotMembers map[int64]*Member

func Init

func Init() MyBotMembers

func (MyBotMembers) AddNewMember

func (bm MyBotMembers) AddNewMember(user *tgbotapi.User, chatId int64) error

func (MyBotMembers) ChangeCurrentTag

func (bm MyBotMembers) ChangeCurrentTag(newTag string, chatId int64) error

func (MyBotMembers) ChangeState

func (bm MyBotMembers) ChangeState(destState int, chatId int64) error

func (MyBotMembers) FindChatIDByUsername

func (bm MyBotMembers) FindChatIDByUsername(un string) int64

func (MyBotMembers) GetCurrentTag

func (bm MyBotMembers) GetCurrentTag(chatId int64) string

func (MyBotMembers) GetState

func (bm MyBotMembers) GetState(chatId int64) int

func (MyBotMembers) GetTags

func (bm MyBotMembers) GetTags(chatId int64) []string

func (MyBotMembers) GetUser

func (bm MyBotMembers) GetUser(chatId int64) *tgbotapi.User

func (MyBotMembers) IsMemberNewUser

func (bm MyBotMembers) IsMemberNewUser(chatId int64) bool

type Player

type Player struct {
	Tag                   string `json:"tag"`
	Name                  string `json:"name"`
	ExpLevel              int    `json:"expLevel"`
	Trophies              int    `json:"trophies"`
	BestTrophies          int    `json:"bestTrophies"`
	Wins                  int    `json:"wins"`
	Losses                int    `json:"losses"`
	BattleCount           int    `json:"battleCount"`
	ThreeCrownWins        int    `json:"threeCrownWins"`
	ChallengeCardsWon     int    `json:"challengeCardsWon"`
	ChallengeMaxWins      int    `json:"challengeMaxWins"`
	TournamentCardsWon    int    `json:"tournamentCardsWon"`
	TournamentBattleCount int    `json:"tournamentBattleCount"`
	Role                  string `json:"role"`
	Donations             int    `json:"donations"`
	DonationsReceived     int    `json:"donationsReceived"`
	TotalDonations        int    `json:"totalDonations"`
	WarDayWins            int    `json:"warDayWins"`
	ClanCardsCollected    int    `json:"clanCardsCollected"`
	Clan                  struct {
		Tag     string `json:"tag"`
		Name    string `json:"name"`
		BadgeID int    `json:"badgeId"`
	} `json:"clan"`
	Arena struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"arena"`
	LeagueStatistics struct {
		CurrentSeason struct {
			Trophies     int `json:"trophies"`
			BestTrophies int `json:"bestTrophies"`
		} `json:"currentSeason"`
		PreviousSeason struct {
			ID           string `json:"id"`
			Trophies     int    `json:"trophies"`
			BestTrophies int    `json:"bestTrophies"`
		} `json:"previousSeason"`
		BestSeason struct {
			ID       string `json:"id"`
			Trophies int    `json:"trophies"`
		} `json:"bestSeason"`
	} `json:"leagueStatistics"`
	Badges []struct {
		Name     string `json:"name"`
		Progress int    `json:"progress"`
	} `json:"badges"`
	Achievements []struct {
		Name           string      `json:"name"`
		Stars          int         `json:"stars"`
		Value          int         `json:"value"`
		Target         int         `json:"target"`
		Info           string      `json:"info"`
		CompletionInfo interface{} `json:"completionInfo"`
	} `json:"achievements"`
	Cards []struct {
		Name     string `json:"name"`
		ID       int    `json:"id"`
		Level    int    `json:"level"`
		MaxLevel int    `json:"maxLevel"`
		Count    int    `json:"count"`
		IconUrls struct {
			Medium string `json:"medium"`
		} `json:"iconUrls"`
	} `json:"cards"`
	CurrentDeck []struct {
		Name     string `json:"name"`
		ID       int    `json:"id"`
		Level    int    `json:"level"`
		MaxLevel int    `json:"maxLevel"`
		Count    int    `json:"count"`
		IconUrls struct {
			Medium string `json:"medium"`
		} `json:"iconUrls"`
	} `json:"currentDeck"`
	CurrentFavouriteCard struct {
		Name     string `json:"name"`
		ID       int    `json:"id"`
		MaxLevel int    `json:"maxLevel"`
		IconUrls struct {
			Medium string `json:"medium"`
		} `json:"iconUrls"`
	} `json:"currentFavouriteCard"`
}

func (*Player) GetPlayerProfileInfo

func (p *Player) GetPlayerProfileInfo() string

func (*Player) TotalWinPercentage

func (p *Player) TotalWinPercentage() (result float64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL