structs

package
v0.0.0-...-9f24b57 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	// Selection is the choice
	Selection string

	// Votes is the number of votes for the choice
	Votes int
}

Choice is a choice in a rank choice vote

type GoogleConfig

type GoogleConfig struct {
	// Enabled is whether or not google sheets is enabled
	Enabled bool

	// KeyFile is the path to the JSON key file
	KeyFile string

	// SheetName is the name of the sheet
	SheetName string

	// SheetID is the ID of the sheet
	SheetID string
}

GoogleConfig is the config for google sheets

type LogLevel

type LogLevel uint8

LogLevel is the type for log levels

type LoggingConfig

type LoggingConfig struct {
	// Level is the log level
	Level string

	// DebugLowChannel is the channel to log debug messages to
	DebugLowChannel string

	// DebugHighChannel is the channel to log debug messages to
	DebugChannel string

	// InfoChannel is the channel to log info messages to
	InfoChannel string

	// WarningChannel is the channel to log warning messages to
	WarningChannel string

	// ErrorChannel is the channel to log error messages to
	ErrorChannel string

	// CriticalChannel is the channel to log critical messages to
	CriticalChannel string

	// AuditChannel is the channel to log audit messages to
	AuditChannel string

	// LogFile is the file to log to
	LogFile string
}

type MailGunConfig

type MailGunConfig struct {
	// Domain is the domain to send emails from
	Domain string

	// APIKey is the API key to use
	APIKey string
}

MailGunConfig is the config for mailgun

type Pair

type Pair[T any] struct {
	Key   T
	Value int
}

type PairList

type PairList[T any] []Pair[T]

func (PairList[T]) Len

func (p PairList[T]) Len() int

func (PairList[T]) Less

func (p PairList[T]) Less(i, j int) bool

func (PairList[T]) Reverse

func (p PairList[T]) Reverse()

func (PairList[T]) Sort

func (p PairList[T]) Sort()

func (PairList[T]) Swap

func (p PairList[T]) Swap(i, j int)

type RankChoiceVote

type RankChoiceVote struct {
	// Title is the title of the vote
	Title string

	// Options is the options in the vote
	Options []string

	// Winner is the winner of the vote
	Winner string

	// Rounds is the rounds of the vote
	Rounds []Round

	// Eliminations is the eliminations of the vote
	Eliminations []string
}

RankChoiceVote is a rank choice vote

func (RankChoiceVote) HTML

func (r RankChoiceVote) HTML() string

ConvertToSanKeyRows converts a map of rounds to a SanKeyRowss

func (RankChoiceVote) String

func (r RankChoiceVote) String() string

ConvertToSanKeyRows converts a map of rounds to a SanKeyRows

type Round

type Round struct {
	// Choices is the choices in the round
	Choices []Choice
}

Round is a round of voting

func ConvertToRound

func ConvertToRound(round map[string]int, options []string) Round

ConvertToSanKeyRows converts a map of rounds to a SanKeyRows

type SanKeyRow

type SanKeyRow struct {
	// From is the from node
	From string

	// To is the to node
	To string

	// Weight is the weight of the node
	Weight int
}

SanKeyRow is a row in a sankey diagram

func (SanKeyRow) String

func (s SanKeyRow) String() string

String returns the string representation of a SanKeyRow

type SanKeyRows

type SanKeyRows struct {
	// Rows is the rows in the sankey diagram
	Rows []SanKeyRow
}

SanKeyRows is a list of rows in a sankey diagram

func (SanKeyRows) String

func (s SanKeyRows) String() string

String returns the string representation of a SanKeyRows

type SlashCommand

type SlashCommand struct {
	// Command is the command to register
	Command *discordgo.ApplicationCommand

	// Handler is the handler for the command
	Handler func(s *discordgo.Session, i *discordgo.InteractionCreate)
}

SlashCommand is a struct that represents a slash command

type WebConfig

type WebConfig struct {
	// Port is the port to listen on
	Port string

	// Hostname is the hostname to listen on
	Hostname string
}

WebConfig is the config for the web server

Jump to

Keyboard shortcuts

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