Documentation ¶
Index ¶
- Variables
- func AdvicesReplacer(locale, entry, response, _ string) (string, string)
- func AreaReplacer(locale, entry, response, _ string) (string, string)
- func CapitalReplacer(locale, entry, response, _ string) (string, string)
- func CurrencyReplacer(locale, entry, response, _ string) (string, string)
- func GenresReplacer(locale, entry, response, token string) (string, string)
- func JokesReplacer(locale, entry, response, _ string) (string, string)
- func MathReplacer(locale, entry, response, _ string) (string, string)
- func MovieSearchFromInformationReplacer(locale, _, response, token string) (string, string)
- func MovieSearchReplacer(locale, entry, response, token string) (string, string)
- func NameGetterReplacer(locale, _, response, token string) (string, string)
- func NameSetterReplacer(locale, entry, response, token string) (string, string)
- func RandomNumberReplacer(locale, entry, response, _ string) (string, string)
- func RegisterModule(locale string, module Module)
- func RegisterModules(locale string, _modules []Module)
- func ReminderGetterReplacer(locale, _, response, token string) (string, string)
- func ReminderSetterReplacer(locale, entry, response, token string) (string, string)
- func ReplaceContent(locale, tag, entry, response, token string) (string, string)
- func SearchDevice(client spotify.Client, content string) spotify.PlayerDevice
- func SearchTrack(client spotify.Client, content string) (spotify.FullTrack, error)
- func SpotifyPlayerReplacer(locale, entry, response, token string) (string, string)
- func SpotifySetterReplacer(locale, entry, _, token string) (string, string)
- type Joke
- type Module
Constants ¶
This section is empty.
Variables ¶
var ( // CapitalTag is the intent tag for its module CapitalTag = "capital" // ArticleCountries is the map of functions to find the article in front of a country // in different languages ArticleCountries = map[string]func(string) string{} )
var ( // GenresTag is the intent tag for its module GenresTag = "movies genres" // MoviesTag is the intent tag for its module MoviesTag = "movies search" // MoviesAlreadyTag is the intent tag for its module MoviesAlreadyTag = "already seen movie" // MoviesDataTag is the intent tag for its module MoviesDataTag = "movies search from data" )
var ( // NameGetterTag is the intent tag for its module NameGetterTag = "name getter" // NameSetterTag is the intent tag for its module NameSetterTag = "name setter" )
var ( // ReminderSetterTag is the intent tag for its module ReminderSetterTag = "reminder setter" // ReminderGetterTag is the intent tag for its module ReminderGetterTag = "reminder getter" )
var ( // SpotifySetterTag is the intent tag for its module SpotifySetterTag = "spotify setter" // SpotifyPlayerTag is the intent tag for its module SpotifyPlayerTag = "spotify player" )
var AdvicesTag = "advices"
AdvicesTag is the intent tag for its module
var AreaTag = "area"
AreaTag is the intent tag for its module
var CurrencyTag = "currency"
CurrencyTag is the intent tag for its module
var JokesTag = "jokes"
JokesTag is the intent tag for its module
var MathTag = "math"
MathTag is the intent tag for its module
var RandomTag = "random number"
RandomTag is the intent tag for its module
Functions ¶
func AdvicesReplacer ¶
AdvicesReplacer replaces the pattern contained inside the response by a random advice from the api specified by the adviceURL. See modules/modules.go#Module.Replacer() for more details.
func AreaReplacer ¶
AreaReplacer replaces the pattern contained inside the response by the area of the country specified in the message. See modules/modules.go#Module.Replacer() for more details.
func CapitalReplacer ¶
CapitalReplacer replaces the pattern contained inside the response by the capital of the country specified in the message. See modules/modules.go#Module.Replacer() for more details.
func CurrencyReplacer ¶
CurrencyReplacer replaces the pattern contained inside the response by the currency of the country specified in the message. See modules/modules.go#Module.Replacer() for more details.
func GenresReplacer ¶
GenresReplacer gets the genre specified in the message and adds it to the user information. See modules/modules.go#Module.Replacer() for more details.
func JokesReplacer ¶
JokesReplacer replaces the pattern contained inside the response by a random joke from the api specified in jokeURL. See modules/modules.go#Module.Replacer() for more details.
func MathReplacer ¶
MathReplacer replaces the pattern contained inside the response by the answer of the math expression specified in the message. See modules/modules.go#Module.Replacer() for more details.
func MovieSearchFromInformationReplacer ¶
MovieSearchFromInformationReplacer replaces the patterns contained inside the response by the movie's name and rating from the genre in the user's information. See modules/modules.go#Module.Replacer() for more details.
func MovieSearchReplacer ¶
MovieSearchReplacer replaces the patterns contained inside the response by the movie's name and rating from the genre specified in the message. See modules/modules.go#Module.Replacer() for more details.
func NameGetterReplacer ¶
NameGetterReplacer replaces the pattern contained inside the response by the user's name. See modules/modules.go#Module.Replacer() for more details.
func NameSetterReplacer ¶
NameSetterReplacer gets the name specified in the message and save it in the user's information. See modules/modules.go#Module.Replacer() for more details.
func RandomNumberReplacer ¶
RandomNumberReplacer replaces the pattern contained inside the response by a random number. See modules/modules.go#Module.Replacer() for more details.
func RegisterModule ¶
RegisterModule registers a module into the map
func RegisterModules ¶
RegisterModules registers an array of modules into the map
func ReminderGetterReplacer ¶
ReminderGetterReplacer gets the reminders in the user's information and replaces the pattern in the response patterns by the current reminders See modules/modules.go#Module.Replacer() for more details.
func ReminderSetterReplacer ¶
ReminderSetterReplacer replaces the pattern contained inside the response by the date of the reminder and its reason. See modules/modules.go#Module.Replacer() for more details.
func ReplaceContent ¶
ReplaceContent apply the Replacer of the matching module to the response and returns it
func SearchDevice ¶
func SearchDevice(client spotify.Client, content string) spotify.PlayerDevice
SearchDevice searches for a device name inside the given sentence and returns it
func SearchTrack ¶
SearchTrack searches for a given track name and returns the found track and the error
func SpotifyPlayerReplacer ¶
SpotifyPlayerReplacer plays a specified music on the user's spotify See modules/modules.go#Module.Replacer() for more details.
func SpotifySetterReplacer ¶
SpotifySetterReplacer gets the tokens in the user entry and save them into the client's information. See modules/modules.go#Module.Replacer() for more details.
Types ¶
type Joke ¶
type Joke struct { ID int64 `json:"id"` Type string `json:"type"` Setup string `json:"setup"` Punchline string `json:"punchline"` }
Joke represents the response from the joke api
type Module ¶
type Module struct { Tag string Patterns []string Responses []string Replacer func(string, string, string, string) (string, string) Context string }
Module is a structure for dynamic intents with a Tag, some Patterns and Responses and a Replacer function to execute the dynamic changes.
func GetModuleByTag ¶
GetModuleByTag returns a module found by the given tag and locale
func GetModules ¶
GetModules returns all the registered modules