config

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Functions to interact with global and guild-specific configuration values.

Index

Constants

This section is empty.

Variables

View Source
var (
	Config         = parseConfig()
	NitoriConfPath string
	TokenOverride  string
	VersionStartup bool
	LogLevel       = getLogLevel()
)

Exported variables for usage in other classes

View Source
var CustomizableMessages = map[string]string{}
View Source
var Prefixes = []string{"conf"}

Functions

func AdvanceTotalMessages

func AdvanceTotalMessages() error

AdvanceTotalMessages advances the total messages processed counter.

func GetCustomizableMessage

func GetCustomizableMessage(gid string, key string) (string, error)

GetCustomizableMessage gets a guild-specific message within predefined messages, returning default if not present.

func GetGuildConfValue added in v1.5.0

func GetGuildConfValue(id, key string) (string, error)

GetGuildConfValue gets a configuration value for a specific guild

func GetPrefix

func GetPrefix(gid string) string

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 ResetGuild

func ResetGuild(gid string)

ResetGuild deletes all db values that belongs to a specific guild.

func ResetGuildConfValue added in v1.5.0

func ResetGuildConfValue(id, key string) error

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 SetCustomizableMessage

func SetCustomizableMessage(gid string, key string, message string) error

SetCustomizableMessage sets a guild-specific message string within predefined messages.

func SetGuildConfValue added in v1.5.0

func SetGuildConfValue(id, key, value string) error

SetGuildConfValue sets a configuration value for a specific guild

Types

type Conf

type Conf struct {
	System struct {
		LogLevel      string
		LogPath       string
		Socket        string
		Database      string
		Prefix        string
		Administrator int
		Operator      []int
	}
	WebServer struct {
		Host                string
		Port                int
		BaseURL             string
		Unix                bool
		ForwardedByClientIP bool
		Secret              string
		RateLimit           int
		RateLimitPeriod     int
	}
	Discord struct {
		Token        string
		ClientSecret string
		Presence     string
		Shard        bool
		ShardCount   int
	}
	LastFM struct {
		ApiKey    string
		ApiSecret string
	}
}

type MessageOutOfBounds

type MessageOutOfBounds struct{}

Configuration related types

func (MessageOutOfBounds) Error

func (err MessageOutOfBounds) Error() string

Jump to

Keyboard shortcuts

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