characters

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

The characters package contains all the features related to characters and quoting them.

As of today the package allows the loading of Characters structures that are a name and a list of associated quote. It also implement basic functionalities on top of the Character structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQuoteFromMessage

func GetQuoteFromMessage(characters []Character, message string) (string, error)

GetQuoteFromMessage returns a random quote from a character if its name is found in the message

Types

type Character

type Character struct {
	Name      string   `json:"name"`
	Sentences []string `json:"sentences"`
}

Character to retrieve quotes from. A Character is a name with a list of sentences.

func MakeCharactersSliceFromFolder

func MakeCharactersSliceFromFolder(folder string) ([]Character, error)

MakeCharactersSliceFromFolder return a slice of characters generated from a folder containing the characters files.

type Properties

type Properties struct {
	Folder string
	List   []Character
}

Properties structure for the package characters Yaml structure to add to the properties' hierarchy :

folder: <characters_folder_path> (folder path where the characters information files are stored)

func (*Properties) UnmarshalYAML

func (properties *Properties) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implementation for the package Properties

Jump to

Keyboard shortcuts

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