prefix

package
v0.0.0-...-daa8be9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExists   = errors.New("The prefix already exists.")
	ErrNotFound = errors.New("The prefix was not found.")
	ErrOneLeft  = errors.New("Only one prefix is left.")

	ErrCustomCommandExists = errors.New("Can't add the prefix %s. A custom command with the name %s exists and would collide with the built-in command of the same name. Either change the custom command or use a different prefix.")
)
View Source
var Admin = admin{}
View Source
var AdminAdd = adminAdd{}
View Source
var AdminDelete = adminDelete{}
View Source
var AdminList = adminList{}
View Source
var AdminReset = adminReset{}
View Source
var Advanced = advanced{}
View Source
var AdvancedAdd = advancedAdd{}
View Source
var AdvancedDelete = advancedDelete{}
View Source
var AdvancedList = advancedList{}
View Source
var AdvancedReset = advancedReset{}
View Source
var Normal = normal{}
View Source
var NormalAdd = normalAdd{}
View Source
var NormalDelete = normalDelete{}
View Source
var NormalReset = normalReset{}

Functions

func Add

func Add(prefix string, t core.CommandType, place int64) (string, error, error)

Add adds a prefix of type t in the specified place. If the prefix, regardless of type, already exists then returns an ErrExists error. If a custom command happens to collide with the newly added prefix (for example if the custom command `.help` exists and the prefix `.` is added then `.help` would collide with the built-in command `help`) then returns an ErrCustomCommandExists error.

func Delete

func Delete(prefix string, t core.CommandType, place int64) (error, error)

Delete removes the prefix of type t from the specified place. If the prefix doesn't exist returns an ErrNotFound error. If there is only one prefix of that type left then returns an ErrOneLeft error.

func List

func List(t core.CommandType, place int64) ([]core.Prefix, error)

List returns a list of prefixes with type t in the specified place. It is possible to return prefixes of multiple types like so:

List(core.Normal|core.Advanced, place)

func Reset

func Reset(place int64) error

Reset wipes all the prefixes from the database making it so the default ones will have to be used.

Types

This section is empty.

Jump to

Keyboard shortcuts

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