dat

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2018 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Log *log.Logger
)

Functions

func AlertDiscord

func AlertDiscord(s *dsg.Session, m *dsg.Message, err error)
# Alerts discord of errors.

* AlertDiscord is a function that... well alerts discord if there's a problem. * Useful for things like if your command fails and you have to return, the user * isn't kept in limbo waiting for something to happen. However this is not a * substitute for posting an error in the log and should be done *along with* * dat.Log.New(), this just helps prevent the users moaning about "broken bot" * and actually proves it to them. * * Parameters: * - s (type *discordgo.Session) : Needed for posting a message * - m (type *discordgo.Message) : Needed for posting a message. Pings .Author. * - err (type error) : The error being reported

func Load

func Load(fileName string, v interface{}) error
Loads a file from json

* This is a simple helper function to manage data persistance and keep it in * one place. * * Parameters * - fileName (string) : where the data is stored. Note that this should * be in the form of $MODULENAME/*.json so modules that * use the same name config.json don't interfere. * - v (interface{}) : the thing you're loading. as a pointer * * Returns: * - error : error has already been logged, but useful for AlertDiscord()

func Save

func Save(fileName string, item interface{}) error
Saves a file to json

* This is a simple helper function to manage data persistance and keep it in * one place. * * Parameters * - fileName (string) : where the data is to be stored. Note that this should * be in the form of $MODULENAME/*.json so modules that * use the same name config.json don't interfere. * - v (interface{}) : the thing you're saving. * * Returns: * - error : error has already been logged, but useful for AlertDiscord()

func SetPath

func SetPath(p string)

Sets the absolute path

Types

This section is empty.

Jump to

Keyboard shortcuts

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