Documentation
¶
Overview ¶
Functions to interact with global and guild-specific configuration values.
Index ¶
- Variables
- func AdvanceTotalMessages() error
- func ExpEnabled(gid string) (enabled bool, err error)
- func ExpToLevel(exp int) int
- func GetCustomizableMessage(gid string, key string) (string, error)
- func GetGuildConfValue(id, key string) (string, error)
- func GetLastfm(user *discordgo.User, guild *discordgo.Guild) (string, error)
- func GetMemberExp(user *discordgo.User, guild *discordgo.Guild) (int, error)
- func GetPrefix(gid string) string
- func GetTotalMessages() int
- func HighlightBindMessage(gid, message, highlight string) error
- func HighlightGetBinding(gid, message string) (string, error)
- func HighlightUnbindMessage(gid, message string) error
- func LevelToExp(level int) int
- func ResetGuild(gid string)
- func ResetGuildConfValue(id, key string) error
- func ResetGuildMap(gid, key string)
- func ResetLastfm(user *discordgo.User, guild *discordgo.Guild) error
- func SetCustomizableMessage(gid string, key string, message string) error
- func SetGuildConfValue(id, key, value string) error
- func SetLastfm(user *discordgo.User, guild *discordgo.Guild, username string) error
- func SetMemberExp(user *discordgo.User, guild *discordgo.Guild, exp int) error
- type Conf
- type DiscordSection
- type LastFMSection
- type MessageOutOfBounds
- type SystemSection
- type WebServerSection
Constants ¶
This section is empty.
Variables ¶
var ( Config = parseConfig() NitoriConfPath string TokenOverride string VersionStartup bool LogLevel = getLogLevel() )
Exported variables for usage in other classes
var CustomizableMessages = map[string]string{
"levelup": "Congratulations $USER on reaching level $LEVEL.",
}
Functions ¶
func AdvanceTotalMessages ¶
func AdvanceTotalMessages() error
AdvanceTotalMessages advances the total messages processed counter.
func ExpEnabled ¶
ExpEnabled queries whether the experience system is enabled for a guild.
func ExpToLevel ¶
ExpToLevel calculates amount of levels from an experience integer.
func GetCustomizableMessage ¶
GetCustomizableMessage gets a guild-specific message within predefined messages, returning default if not present.
func GetGuildConfValue ¶ added in v1.5.0
GetGuildConfValue gets a configuration value for a specific guild
func GetMemberExp ¶
GetMemberExp obtains experience amount of a guild member.
func GetPrefix ¶
GetPrefix gets the command prefix of a guild and returns the default if none is set.
func GetTotalMessages ¶
func GetTotalMessages() int
GetTotalMessages gets the total amount of messages processed.
func HighlightBindMessage ¶ added in v1.5.0
HighlightBindMessage binds a message with the highlight message.
func HighlightGetBinding ¶ added in v1.5.0
HighlightGetBinding gets the binding of a message.
func HighlightUnbindMessage ¶ added in v1.5.0
HighlightUnbindMessage unbinds a message with the highlight message.
func LevelToExp ¶
LevelToExp calculates amount of experience from a level integer.
func ResetGuild ¶
func ResetGuild(gid string)
ResetGuild deletes all database values that belongs to a specific guild.
func ResetGuildConfValue ¶ added in v1.5.0
ResetGuildConfValue resets a configuration value for a specific guild
func ResetGuildMap ¶ added in v1.5.0
func ResetGuildMap(gid, key string)
ResetGuildMap deletes a map that belongs to a specific guild.
func ResetLastfm ¶
ResetLastfm resets a user's lastfm username.
func SetCustomizableMessage ¶
SetCustomizableMessage sets a guild-specific message string within predefined messages.
func SetGuildConfValue ¶ added in v1.5.0
SetGuildConfValue sets a configuration value for a specific guild
Types ¶
type Conf ¶
type Conf struct { System SystemSection WebServer WebServerSection Discord DiscordSection LastFM LastFMSection }
type DiscordSection ¶
type LastFMSection ¶
type MessageOutOfBounds ¶
type MessageOutOfBounds struct{}
Configuration related types
func (MessageOutOfBounds) Error ¶
func (err MessageOutOfBounds) Error() string