Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type PlayerScore
- type QueryCallbackHandlerFn
- type Session
- func (r *Session) AddPlayer(player *model.Player) error
- func (r *Session) AlivePlayersLen() int
- func (r *Session) ChangeState(kind uint8)
- func (r *Session) Execute(userID int64, upd tgbotapi.Update) error
- func (r *Session) Favorites() []PlayerScore
- func (r *Session) MoveState(kind uint8)
- func (r *Session) RemovePlayer(userID int64)
- func (r *Session) Run(ctx context.Context)
- func (r *Session) Scores() []PlayerScore
- func (r *Session) Stop()
Constants ¶
View Source
const ( StateKindWaiting uint8 = iota + 1 StateKindPlaying StateKindProcessing StateKindFinished )
Variables ¶
View Source
var ( ErrContextFatalClosed = fmt.Errorf("context closed") ErrValidation = fmt.Errorf("validation errors") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { AuthorID int64 `json:"authorId"` AuthorName string `json:"authorName"` RoundsNum int `json:"roundsNum"` RoundTime int `json:"roundTime"` Categories []string `json:"categories"` Letters []string `json:"letters"` Bloopses []resource.Bloops `json:"bloopses"` Vote bool `json:"vote"` Code int64 `json:"code"` State uint8 `json:"state"` CurrRoundIdx int `json:"currRoundIdx"` Tg *tgbotapi.BotAPI `json:"-"` DoneFn func(session *Session) error `json:"-"` WarnFn func(session *Session) error `json:"-"` Timeout time.Duration `json:"-"` }
type PlayerScore ¶
type QueryCallbackHandlerFn ¶
type QueryCallbackHandlerFn func(query *tgbotapi.CallbackQuery) error
type Session ¶
type Session struct { Config Config Code int64 CreatedAt time.Time Players []*model.Player CurrRoundIdx int State uint8 // contains filtered or unexported fields }
func NewSession ¶
func (*Session) AlivePlayersLen ¶
func (*Session) ChangeState ¶
func (*Session) Favorites ¶
func (r *Session) Favorites() []PlayerScore
func (*Session) RemovePlayer ¶
remove player from game and send asyncBroadcast message about it
Click to show internal directories.
Click to hide internal directories.