vote

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseChatMessage

func ParseChatMessage(line string) (player, message string, ok bool)

ParseChatMessage extracts player name and message from a server log line.

func TailLog

func TailLog(ctx context.Context, path string) (<-chan string, error)

TailLog opens a log file, seeks to the end, and sends new lines to the returned channel. It polls for new data and stops when ctx is cancelled.

Types

type Config

type Config struct {
	Maps       []string      // candidate map pool
	Duration   time.Duration // vote window
	MaxChoices int           // maps shown per vote
	ServerDir  string
	Screen     *management.ScreenManager
	Output     *ui.UI
}

Config configures a map vote session.

type Result

type Result struct {
	Winner string
	Votes  map[string]int
	Voters int
}

Result holds the outcome of a completed vote.

func RunVote

func RunVote(ctx context.Context, cfg Config) (*Result, error)

RunVote runs a complete map vote: broadcast options, collect votes from the server log, tally results, and announce the winner.

Jump to

Keyboard shortcuts

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