Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Challenge ¶
type Challenge struct {
// UsersShown is the list of all IDs shown
UsersShown []string
// RightAnswerIndex holds the index in `UsersShown` that is the
// person we're looking for.
RightAnswerIndex int
// Replies holds the first replies for each user ID, only first
// response is accounted for.
Replies map[string]int
// FirstCorrectReply holds the user ID of the first user that
// replied correctly.
FirstCorrectReply string
// ImageURL is the image URL to show
ImageURL string
}
Challenge is one shot of images being shown, and replies being gathered for 10 seconds before declaring a winner.
func (*Challenge) BuildImage ¶
BuildImage builds a new image with 4 square images and overlays numbers on top (translucent). It sends to S3 and returns the public URL.
func (*Challenge) HandleUserReply ¶
type Faceoff ¶
Faceoff contains configuration for running faceoff
func (*Faceoff) ComputeUserScores ¶
func (p *Faceoff) ComputeUserScores()
func (*Faceoff) InitPlugin ¶
InitPlugin establishes the regex and listeners
func (*Faceoff) UpdateUsersWithChallengeResults ¶
type Game ¶
type Game struct {
// Channel in which the game is running
Faceoff *Faceoff
OriginalMessage *bawt.Message
Channel *bawt.Channel
Started time.Time
GameCount int // number of games we did
Challenges []*Challenge
}
Game is a run of multiple challenges in channel
type User ¶
type User struct {
// `bawt.GetUser` ID
ID string
// Count of good answers, fastest or not.
RightAnswers int
// Count of bad answers,
WrongAnswers int
// Number of times the user was right and was the fastest.
Fastest int
// FoundUsers is a map to be used for completeness score, in next
// version.
FoundUsers map[string]bool
// Number of times this user was looked for
LookedFor int
// Number of times this user was shown but wasn't the person we looked for.
Shown int
// Number of times this user was found
Found int
// PerformanceScore is a score composed of accuracy and speed
// (successRate and fastest), relatively to others.
PerformanceScore int
// RankPosition is the position of this user relatively to other
// users. It is possible that several users are at the same
// ranking position, if they have the same score.
RankPosition int
// RankAgainst is the total number of players
RankAgainst int
// Whether this users is excluded from the game.
Excluded bool
}
func (*User) SuccessRate ¶
SuccessRate returns a percentage of the time the user was right, as compared to his bad answers.
Click to show internal directories.
Click to hide internal directories.