state

package
v0.0.0-...-e19ce98 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabaseInstance

func GetDatabaseInstance(file string) (*bolt.DB, error)

GetDatabaseInstance get a bolt database instance. TODO: defer close?

func GetGuildValue

func GetGuildValue(bucket, key string) ([]byte, error)

GetGuildValue retrieves a value using guildID and a key bucket == GuildID

func GetInstance

func GetInstance() (*bolt.DB, error)

GetInstance get a bolt database instance using the default database file

func IsReserved

func IsReserved(state Type) bool

IsReserved check if given state is reserved. These cannot be used for custom states. Custom states starts at 11 and ends at 255. custom state range [11, 255].

func SetGuildState

func SetGuildState(guildID string, state Type) error

SetGuildState updates the guild state in database

func SetGuildValue

func SetGuildValue(bucket, key string, val []byte) error

SetGuildValue sets a value using guildID, key and a value bucket == GuildID

func ToStr

func ToStr(state Type) string

ToStr convert state.Type into string

Types

type Type

type Type uint8

Type state type

const (
	// MissingState is used when no state was specified
	MissingState Type = iota // 0
	// Normal is the default bot state
	Normal // 1

	// Pause is used when the bot should not react to events
	Pause // 2

	// Debug should gives more detailed discord feedback
	Debug // 3

	// Silence Respond to nothing
	Silence // 4

	// Reserved5 ..
	Reserved5

	// Reserved6 ..
	Reserved6

	// Reserved7 ..
	Reserved7

	// Reserved8 ..
	Reserved8

	// Reserved9 ..
	Reserved9

	// Reserved10 ..
	Reserved10
)

Different reserved states

func GetGuildState

func GetGuildState(guildID string) (Type, error)

GetGuildState returns the state of guild

Jump to

Keyboard shortcuts

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