utils

package
v0.0.0-...-15b0568 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpConfigFormat

func DumpConfigFormat(filename string) error

DumpConfigFormat will write out a sample config with the default values. It be written to the path of the filename string supplied. Returns an error if one is encountered.

func HTTPDownloadToString

func HTTPDownloadToString(url string, desc string) (string, error)

HTTPDownloadToString takes a string of a URL, and attempts to download the data, if successful it is converted to a string and returned, otherwise an empty string is returned with an error.

Types

type BotConfig

type BotConfig struct {
	Volume                 float64 `json:"volume"`
	YtDlPath               string  `json:"ytdl_path"`
	SaveVideos             bool    `json:"save_videos"`
	CacheDir               string  `json:"cache_dir"`
	UsePlaylist            bool    `json:"use_playlist"`
	PlaylistPath           string  `json:"playlist_path"`
	AutoPause              bool    `json:"auto_pause"`
	DeleteMessages         bool    `json:"delete_messages"`
	DeleteInvokingMessages bool    `json:"delete_invoking_messages"`
	NowPlayingMentions     bool    `json:"now_playing_mentions"`
	SkipsRequired          int     `json:"skips_required"`
	SkipRatio              float64 `json:"skip_ratio"`
}

BotConfig is used to the the bot specific configuration.

type Config

type Config struct {
	BotToken      string    `json:"bot_token"`
	OwnerID       string    `json:"owner_id"`
	GoogleAPIKey  string    `json:"google_api_key"`
	CommandPrefix string    `json:"command_prefix"`
	Bot           BotConfig `json:"bot"`
	Guilds        []Guilds  `json:"guilds"`
}

Config is used to store the application configuration.

func LoadConfig

func LoadConfig(filename string) (*Config, error)

LoadConfig takes a string for a filename and attempts to load it and unmarshal the json inside. Also, auth tokens are attempted to be found as environment variables. If successful, returns a pointer to a Config object, otherwise returns an error.

type Guilds

type Guilds struct {
	BindToTextChannels   []string `json:"bind_to_text_channels"`
	AutoJoinVoiceChannel string   `json:"auto_join_voice_channel"`
}

Guilds stores channel information for each guild/server your bot connects too

Jump to

Keyboard shortcuts

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