commands

package
v0.0.0-...-b9cfb1f Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(name string, description string, permission string, aliases []string, function interface{}) *Command

NewCommand returns a new command with the given command function. The permission used in the command should be registered in order to get correct output.

func (*Command) AppendArgument

func (command *Command) AppendArgument(argument *arguments.Argument)

AppendArgument adds one argument to the command.

func (*Command) Execute

func (command *Command) Execute(sender Sender, commandArgs []string)

Execute executes the command with the given sender and command arguments.

func (*Command) ExemptFromPermissionCheck

func (command *Command) ExemptFromPermissionCheck(value bool)

ExemptFromPermissionCheck sets the command exempted from permission checking, allowing anybody to use it.

func (*Command) GetAliases

func (command *Command) GetAliases() []string

GetAliases returns the aliases of this command.

func (*Command) GetArguments

func (command *Command) GetArguments() []*arguments.Argument

GetArguments returns a slice with all arguments.

func (*Command) GetDescription

func (command *Command) GetDescription() string

GetDescription returns the command description.

func (*Command) GetName

func (command *Command) GetName() string

GetName returns the command name.

func (*Command) GetPermission

func (command *Command) GetPermission() string

GetPermission returns the command permission string.

func (*Command) GetUsage

func (command *Command) GetUsage() string

GetUsage returns the usage of this command. The usage will get parsed if it had not yet been.

func (*Command) IsPermissionChecked

func (command *Command) IsPermissionChecked() bool

IsPermissionChecked checks if the user of this command is checked for the adequate permission.

func (*Command) SetArguments

func (command *Command) SetArguments(arguments []*arguments.Argument)

SetArguments sets the command arguments.

func (*Command) SetDescription

func (command *Command) SetDescription(description string)

SetDescription sets the description of the command.

func (*Command) SetPermission

func (command *Command) SetPermission(permission string)

SetPermission sets the permission of the command.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

NewManager returns a new Manager struct.

func (*Manager) AliasExists

func (holder *Manager) AliasExists(aliasName string) bool

AliasExists checks if the given alias exists or not.

func (*Manager) DeregisterCommand

func (holder *Manager) DeregisterCommand(commandName string) bool

DeregisterCommand deregisters a command from the command holder. Also deregisters all command aliases.

func (*Manager) GetCommand

func (holder *Manager) GetCommand(commandName string) (*Command, error)

GetCommand returns a command regardless whether it's an alias or the command name, or an error if none was found.

func (*Manager) GetCommandByAlias

func (holder *Manager) GetCommandByAlias(aliasName string) (*Command, error)

GetCommandByAlias returns a command by alias, and an error if none was found.

func (*Manager) GetCommandByName

func (holder *Manager) GetCommandByName(commandName string) (*Command, error)

GetCommandByName returns a command by name, and an error if none was found.

func (*Manager) IsCommandRegistered

func (holder *Manager) IsCommandRegistered(commandName string) bool

IsCommandRegistered checks if the command has been registered. Also checks for aliases.

func (*Manager) RegisterCommand

func (holder *Manager) RegisterCommand(command *Command)

RegisterCommand registers a command in the command holder with the including aliases.

type Sender

type Sender interface {
	HasPermission(string) bool
	SendMessage(...interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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