Documentation ¶
Index ¶
Constants ¶
View Source
const ( TelegramChatIDField = "telegram_chat_id" ActiveGameField = "active_game" StatisticsField = "statistics" DeckField = "deck" )
View Source
const ( StartCommand = "start" StatsCommand = "stats" NewGameCommand = "new" DrawCardCommand = "draw" StopDrawingCommand = "stop" )
View Source
const ( GameDealerField = "dealer" GamePlayersField = "players" GamePlayerUsernameField = "username" GamePlayerCardsField = "cards" GamePlayerStopField = "stop" GamePlayerBustedField = "busted" )
View Source
const NumOfCardsInDeck = 52
Variables ¶
View Source
var ( ErrNotFound = errors.New("404 Not Found") ErrServerError = errors.New("500 Server Error") ErrChatRegistered = errors.New("chat already registered") ErrActiveGame = errors.New("chat has active game") ErrNoActiveGame = errors.New("chat has no active game") ErrDeckEmpty = errors.New("deck is empty") ErrAlreadyStopped = errors.New("you are already stopped drawing") ErrBusted = errors.New("more than 21") ErrCantDraw = errors.New("player can't draw more cards") )
View Source
var CardSymbols = []string{
"♣",
"♦",
"♥",
"♠",
}
View Source
var CardValues = map[string]int{
"A": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
"10": 10,
"J": 10,
"Q": 10,
"K": 10,
}
Functions ¶
This section is empty.
Types ¶
type Chat ¶
type Chat struct { TelegramChatID int64 `bson:"telegram_chat_id"` ActiveGame *Game `bson:"active_game"` Statistics UsersStatistics `bson:"statistics"` Deck *Deck `bson:"deck"` }
type Deck ¶
type Deck struct { Cards Cards `bson:"cards"` // contains filtered or unexported fields }
func NewDeckWithCards ¶
type SortedUserStatistics ¶
type SortedUserStatistics []userStatistics
type UsersStatistics ¶
func (UsersStatistics) SortByValue ¶
func (u UsersStatistics) SortByValue() SortedUserStatistics
Source Files ¶
Click to show internal directories.
Click to hide internal directories.