commands

package
v0.0.0-...-52a80d5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandEquals

func CommandEquals(cmd Command, text string) bool

CommandEquals checks whether the text given matches either the name of the given command or one of it's aliases.

func ParseCommand

func ParseCommand(input string) []string

ParseCommand takes an arbitrary input string and splits it into parameters. The first parameter (index 0) will always be the command itself.

func PrintError

func PrintError(writer io.Writer, error, reason string)

PrintError message writes an error to the given io.Writer in the default format, using the correct colors and punctuation.

Types

type ClientState

type ClientState interface {
	GetSelectedGuild() *discordgo.Guild
	GetSelectedChannel() *discordgo.Channel
}

type Command

type Command interface {
	// Execute runs the command piping its output into the supplied writer.
	Execute(writer io.Writer, parameters []string)

	// PrintHelp prints a static help page for this command
	PrintHelp(writer io.Writer)

	// Name returns the primary name for this command. This name will also be
	// used for listing the command in the commandlist.
	Name() string

	// Aliases are a list of aliases for this command. There might be none.
	Aliases() []string
}

Command represents a command that is executable by the user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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