trivia

package
v2.40.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSessionInChannel = errors.New("a trivia session already exists in this channel")
View Source
var TriviaDuration = time.Second * 30

Functions

func RegisterPlugin

func RegisterPlugin()

Types

type Plugin

type Plugin struct{}

func (*Plugin) AddCommands

func (p *Plugin) AddCommands()

func (*Plugin) BotInit

func (p *Plugin) BotInit()

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

type TriviaQuestion

type TriviaQuestion struct {
	Question string   `json:"question"`
	Answer   string   `json:"correct_answer"`
	Category string   `json:"category"`
	Type     string   `json:"type"`
	Options  []string `json:"incorrect_answers"`
}

func FetchQuestions

func FetchQuestions(amount int) ([]*TriviaQuestion, error)

func (*TriviaQuestion) Decode

func (q *TriviaQuestion) Decode()

func (*TriviaQuestion) RandomizeOptionOrder

func (q *TriviaQuestion) RandomizeOptionOrder()

RandomizeOptionOrder randomizes the option order and returns the result this also adds the answer to the list of options

type TriviaResponse

type TriviaResponse struct {
	Code      int               `json:"response_code"`
	Questions []*TriviaQuestion `json:"results"`
}

Jump to

Keyboard shortcuts

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