commandclient

package
v0.0.0-...-ca665c3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandClient

type CommandClient struct {
	Prefix             string
	Register           map[string]func(ctx *Context)
	OnMissingPrefix    func(s *discordgo.Session, m *discordgo.MessageCreate)
	OnUnknownCommand   func(s *discordgo.Session, m *discordgo.MessageCreate, args []string)
	OnSuccessfulInvoke func(ctx *Context, command func(ctx *Context))
}

CommandClient session/command register

func New

func New(prefix string) *CommandClient

New creates new command client

func (*CommandClient) Parse

Parse parses a message event

func (*CommandClient) ParsePrefix

func (p *CommandClient) ParsePrefix(s *discordgo.Session, content string) int

ParsePrefix returns length of prefix if present

type Context

type Context struct {
	Client  *CommandClient
	Session *discordgo.Session
	Message *discordgo.MessageCreate
	Args    []string
}

Context stores command context

Jump to

Keyboard shortcuts

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