Documentation ¶
Index ¶
- func ValidateRound(r Round) error
- type Client
- func (c *Client) ClearPuzzleVoiceRoom(ctx context.Context, room string) error
- func (c *Client) CompleteDiscoveredPuzzle(ctx context.Context, id int64) error
- func (c *Client) CompleteDiscoveredRound(ctx context.Context, id int64, round Round) error
- func (c *Client) CreateDiscoveredPuzzle(ctx context.Context, puzzle db.CreateDiscoveredPuzzleParams) error
- func (c *Client) CreateDiscoveredRound(ctx context.Context, round string) (int64, error)
- func (c *Client) CreatePuzzle(ctx context.Context, puzzle RawPuzzle) (Puzzle, int64, error)
- func (c *Client) CreateRound(ctx context.Context, round Round) (Round, int64, error)
- func (c *Client) DeletePuzzle(ctx context.Context, id int64) (int64, error)
- func (c *Client) DeleteRound(ctx context.Context, id int64) (int64, error)
- func (c *Client) DiscoveryConfig(ctx context.Context) (DiscoveryConfig, error)
- func (c *Client) EnableDiscovery(ctx context.Context, enabled bool) bool
- func (c *Client) GetCreatedRound(ctx context.Context, name string) (Round, error)
- func (c *Client) GetDiscoveredRound(ctx context.Context, name string) (db.DiscoveredRound, error)
- func (c *Client) GetPuzzle(ctx context.Context, id int64) (Puzzle, error)
- func (c *Client) GetPuzzleByChannel(ctx context.Context, channel string) (Puzzle, error)
- func (c *Client) GetRound(ctx context.Context, id int64) (Round, error)
- func (c *Client) IncrementSyncEpoch(ctx context.Context) (int64, error)
- func (c *Client) IsEnabled(ctx context.Context) bool
- func (c *Client) IsPuzzleCreated(ctx context.Context, puzzle ScrapedPuzzle) (bool, error)
- func (c *Client) IsPuzzleDiscovered(ctx context.Context, puzzle ScrapedPuzzle) (bool, error)
- func (c *Client) ListCreatablePuzzles(ctx context.Context) ([]db.ListCreatablePuzzlesRow, error)
- func (c *Client) ListDiscoveredPuzzlesForRound(ctx context.Context, id int64) ([]db.DiscoveredPuzzle, error)
- func (c *Client) ListHome(ctx context.Context) ([]Puzzle, []Round, int64, error)
- func (c *Client) ListPendingDiscoveredRounds(ctx context.Context) ([]db.DiscoveredRound, error)
- func (c *Client) ListPuzzles(ctx context.Context) ([]Puzzle, error)
- func (c *Client) ListRounds(ctx context.Context) ([]Round, error)
- func (c *Client) ListVoiceRoomInfo(ctx context.Context) ([]VoiceInfo, error)
- func (c *Client) ReminderTimestamp(ctx context.Context) (time.Time, error)
- func (c *Client) SetReminderTimestamp(ctx context.Context, reminder time.Time) error
- func (c *Client) UpdateDiscoveredRound(ctx context.Context, round db.DiscoveredRound) error
- func (c *Client) UpdateDiscoveryConfig(ctx context.Context, mutate func(config *DiscoveryConfig) error) (DiscoveryConfig, error)
- func (c *Client) UpdatePuzzle(ctx context.Context, id int64, mutate func(puzzle *RawPuzzle) error) (Puzzle, int64, error)
- func (c *Client) UpdatePuzzleByDiscordChannel(ctx context.Context, channel string, mutate func(puzzle *RawPuzzle) error) (PuzzleChange, error)
- func (c *Client) UpdateRound(ctx context.Context, id int64, mutate func(round *Round) error) (Round, int64, error)
- func (c *Client) ValidatePuzzle(ctx context.Context, p RawPuzzle) error
- type DiscoveryConfig
- type Puzzle
- type PuzzleChange
- type RawPuzzle
- type Round
- type RoundChange
- type ScrapedPuzzle
- type ScrapedRound
- type ValidationError
- type VoiceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateRound ¶
Types ¶
type Client ¶
type Client struct { // Important: to avoid deadlocks, do not send to this channel while holding // the lock below. DiscoveryChange chan bool PuzzleChange chan PuzzleChange RoundChange chan RoundChange // contains filtered or unexported fields }
func (*Client) ClearPuzzleVoiceRoom ¶
func (*Client) CompleteDiscoveredPuzzle ¶
func (*Client) CompleteDiscoveredRound ¶
func (*Client) CreateDiscoveredPuzzle ¶
func (*Client) CreateDiscoveredRound ¶
func (*Client) CreatePuzzle ¶
func (*Client) CreateRound ¶
func (*Client) DeletePuzzle ¶
func (*Client) DeleteRound ¶
func (*Client) DiscoveryConfig ¶
func (c *Client) DiscoveryConfig(ctx context.Context) (DiscoveryConfig, error)
func (*Client) EnableDiscovery ¶
func (*Client) GetCreatedRound ¶
func (*Client) GetDiscoveredRound ¶
func (*Client) GetPuzzleByChannel ¶
func (*Client) IncrementSyncEpoch ¶
func (*Client) IsPuzzleCreated ¶
func (*Client) IsPuzzleDiscovered ¶
func (*Client) ListCreatablePuzzles ¶
func (*Client) ListDiscoveredPuzzlesForRound ¶
func (*Client) ListPendingDiscoveredRounds ¶
func (*Client) ListVoiceRoomInfo ¶
func (*Client) ReminderTimestamp ¶
func (*Client) SetReminderTimestamp ¶
func (*Client) UpdateDiscoveredRound ¶
func (*Client) UpdateDiscoveryConfig ¶
func (c *Client) UpdateDiscoveryConfig(ctx context.Context, mutate func(config *DiscoveryConfig) error) (DiscoveryConfig, error)
func (*Client) UpdatePuzzle ¶
func (*Client) UpdatePuzzleByDiscordChannel ¶
func (*Client) UpdateRound ¶
type DiscoveryConfig ¶
type DiscoveryConfig struct { // URL of the "All Puzzles" page on the hunt website PuzzlesURL string `json:"puzzles_url"` CookieName string `json:"cookie_name"` CookieValue string `json:"cookie_value"` // Group Mode: in many years (2021, 2020, etc.), the puzzle list is grouped // by round, and there is some grouping element (e.g. a <section>) for each // round that contains both the round name and the list of puzzles. // // In other years (2022), the puzzle list is presented as a sequence of // alternating round names (e.g. <h2>) and puzzle lists (e.g. <table>) with // no grouping element. If this is the case, set `groupedMode=false` and use // the group selector to select the overall container. Note that the round // name element must be an *immediate* child of the container, and the // puzzle list element must be its immediate sibling. // // EXAMPLES // // 2022 (https://puzzles.mit.edu/2022/puzzles/) // - Group: `section#main-content` (group mode off) // - Round Name: `h2` // - Puzzle List: `table` // // 2021 (https://puzzles.mit.edu/2021/puzzles.html) // - Group: `.info div section` (group mode on) // - Round Name: `a h3` // - Puzzle List: `table` // // 2020 (https://puzzles.mit.edu/2020/puzzles/) // - Group: `#loplist > li:not(:first-child)` (group mode on) // - Round Name: `a` // - Puzzle List: `ul li a` // // 2019 (https://puzzles.mit.edu/2019/puzzle.html) // - Group: `.puzzle-list-section:nth-child(2) .round-list-item` (group mode on) // - Round Name: `.round-list-header` // - Puzzle List: `.round-list-item` // - Puzzle Item: `.puzzle-list-item a` // GroupMode bool `json:"group_mode"` GroupSelector string `json:"group_selector"` RoundNameSelector string `json:"round_name_selector"` PuzzleListSelector string `json:"puzzle_list_selector"` // Optional: defaults to "a" (this is probably what you want) PuzzleItemSelector string `json:"puzzle_item_selector"` // URL of the websocket endpoint (optional) WebsocketURL string `json:"websocket_url"` // Token to send in the AUTH message (optional) WebsocketToken string `json:"websocket_token"` }
type Puzzle ¶
type Puzzle struct { ID int64 `json:"id"` Name string `json:"name"` Answer string `json:"answer"` Round Round `json:"round"` Status status.Status `json:"status"` Note string `json:"note"` Location string `json:"location"` PuzzleURL string `json:"puzzle_url"` SpreadsheetID string `json:"spreadsheet_id"` DiscordChannel string `json:"discord_channel"` Meta bool `json:"meta"` VoiceRoom string `json:"voice_room"` Reminder time.Time `json:"reminder"` }
Must match db.GetPuzzleRow and db.ListPuzzlesRow
func (Puzzle) HasReminder ¶
type PuzzleChange ¶
type RoundChange ¶
type ScrapedPuzzle ¶
type ScrapedRound ¶
type ScrapedRound struct { MessageID string Name string NotifiedAt time.Time Puzzles []ScrapedPuzzle }
type ValidationError ¶
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type VoiceInfo ¶
type VoiceInfo = db.ListPuzzlesByVoiceRoomRow
Click to show internal directories.
Click to hide internal directories.