Documentation ¶
Index ¶
- func FormatReactionRankings(r []storage.TopReactionEntry, reaction string, s *discord.Session) (embed *discordgo.MessageEmbed, err error)
- func FormatUserReactions(reactions *[]storage.ReactionCounter, author *discordgo.User, ...) (embed *discordgo.MessageEmbed, err error)
- type Command
- type CommandManager
- func (cm *CommandManager) Init(config *types.Config, discord *discord.Session, api storage.Storer, ...) (err error)
- func (cm *CommandManager) LoadCommands()
- func (cm *CommandManager) OnMessage(message discordgo.Message) (err error)
- func (cm *CommandManager) TryFindAndFireCommand(interaction *discordgo.InteractionCreate)
- type CommandParametersRange
- type Hit
- type Results
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatReactionRankings ¶
func FormatReactionRankings(r []storage.TopReactionEntry, reaction string, s *discord.Session) (embed *discordgo.MessageEmbed, err error)
func FormatUserReactions ¶
func FormatUserReactions(reactions *[]storage.ReactionCounter, author *discordgo.User, session *discord.Session) (embed *discordgo.MessageEmbed, err error)
Types ¶
type Command ¶
type Command struct { Function func(interaction *discordgo.InteractionCreate, args map[string]*discordgo.ApplicationCommandInteractionDataOption, settings types.CommandSettings) (context bool, err error) Name string Description string Settings types.CommandSettings Options []*discordgo.ApplicationCommandOption IsAdministrative bool }
Command represents a public, private or administrative command
type CommandManager ¶
type CommandManager struct { Config *types.Config Discord *discord.Session Storage storage.Storer Forum *forum.ForumClient Commands []Command Contexts *cache.Cache Cooldowns map[string]time.Time Cache *cache.Cache }
CommandManager stores command state
func (*CommandManager) Init ¶
func (cm *CommandManager) Init( config *types.Config, discord *discord.Session, api storage.Storer, fc *forum.ForumClient, ) (err error)
Init creates a command manager for the app
func (*CommandManager) LoadCommands ¶
func (cm *CommandManager) LoadCommands()
LoadCommands is called on initialisation and is responsible for registering all commands and binding them to functions.
func (*CommandManager) OnMessage ¶
func (cm *CommandManager) OnMessage(message discordgo.Message) (err error)
OnMessage is called on a command string to check whether it's a valid command and, if so, call the associated function. nolint:gocyclo
func (*CommandManager) TryFindAndFireCommand ¶
func (cm *CommandManager) TryFindAndFireCommand(interaction *discordgo.InteractionCreate)
type CommandParametersRange ¶
CommandParametersRange represents minimum value and maximum value number of parameters for a command
type Results ¶
type Results struct { Status struct { Total int `json:"total"` Failed int `json:"failed"` Successful int `json:"successful"` } `json:"status"` Request struct { Query struct { Query string `json:"query"` } `json:"query"` Size int `json:"size"` From int `json:"from"` Highlight struct { Style interface{} `json:"style"` Fields interface{} `json:"fields"` } `json:"highlight"` Fields interface{} `json:"fields"` Facets interface{} `json:"facets"` Explain bool `json:"explain"` Sort []string `json:"sort"` IncludeLocations bool `json:"includeLocations"` SearchAfter interface{} `json:"search_after"` SearchBefore interface{} `json:"search_before"` } `json:"request"` Hits []Hit `json:"hits"` TotalHits int `json:"total"` Took int64 `json:"took"` }
Click to show internal directories.
Click to hide internal directories.