commands

package
v0.0.0-...-35e93be Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveChannel

func ArchiveChannel(ctx *Context) (err error)

func ExecuteModule

func ExecuteModule(name string, ctx *Context, AmountArgs int, handler Handler) (err error)

func SearchRepository

func SearchRepository(ctx *Context) (err error)

Types

type CmdBan

type CmdBan struct{}

ban command

func (*CmdBan) AdminRequired

func (c *CmdBan) AdminRequired() bool

func (*CmdBan) DMsAllowed

func (c *CmdBan) DMsAllowed() bool

func (*CmdBan) Description

func (c *CmdBan) Description() string

func (*CmdBan) Exec

func (c *CmdBan) Exec(ctx *Context) (err error)

func (*CmdBan) Invokes

func (c *CmdBan) Invokes() []string

type CmdGithub

type CmdGithub struct{}

func (*CmdGithub) AdminRequired

func (c *CmdGithub) AdminRequired() bool

func (*CmdGithub) DMsAllowed

func (c *CmdGithub) DMsAllowed() bool

func (*CmdGithub) Description

func (c *CmdGithub) Description() string

func (*CmdGithub) Exec

func (c *CmdGithub) Exec(ctx *Context) (err error)

func (*CmdGithub) Invokes

func (c *CmdGithub) Invokes() []string

type CmdKick

type CmdKick struct{}

func (*CmdKick) AdminRequired

func (c *CmdKick) AdminRequired() bool

func (*CmdKick) DMsAllowed

func (c *CmdKick) DMsAllowed() bool

func (*CmdKick) Description

func (c *CmdKick) Description() string

func (*CmdKick) Exec

func (c *CmdKick) Exec(ctx *Context) (err error)

func (*CmdKick) Invokes

func (c *CmdKick) Invokes() []string

type CmdLogCopy

type CmdLogCopy struct{}

ban command

func (*CmdLogCopy) AdminRequired

func (c *CmdLogCopy) AdminRequired() bool

func (*CmdLogCopy) DMsAllowed

func (c *CmdLogCopy) DMsAllowed() bool

func (*CmdLogCopy) Description

func (c *CmdLogCopy) Description() string

func (*CmdLogCopy) Exec

func (c *CmdLogCopy) Exec(ctx *Context) (err error)

func (*CmdLogCopy) Invokes

func (c *CmdLogCopy) Invokes() []string

type CmdPing

type CmdPing struct{}

func (*CmdPing) AdminRequired

func (c *CmdPing) AdminRequired() bool

func (*CmdPing) DMsAllowed

func (c *CmdPing) DMsAllowed() bool

func (*CmdPing) Description

func (c *CmdPing) Description() string

func (*CmdPing) Exec

func (c *CmdPing) Exec(ctx *Context) (err error)

func (*CmdPing) Invokes

func (c *CmdPing) Invokes() []string

type CmdPurge

type CmdPurge struct{}

func (*CmdPurge) AdminRequired

func (c *CmdPurge) AdminRequired() bool

func (*CmdPurge) DMsAllowed

func (c *CmdPurge) DMsAllowed() bool

func (*CmdPurge) Description

func (c *CmdPurge) Description() string

func (*CmdPurge) Exec

func (c *CmdPurge) Exec(ctx *Context) (err error)

func (*CmdPurge) Invokes

func (c *CmdPurge) Invokes() []string

type CmdReport

type CmdReport struct{}

func (*CmdReport) AdminRequired

func (c *CmdReport) AdminRequired() bool

func (*CmdReport) DMsAllowed

func (c *CmdReport) DMsAllowed() bool

func (*CmdReport) Description

func (c *CmdReport) Description() string

func (*CmdReport) Exec

func (c *CmdReport) Exec(ctx *Context) (err error)

func (*CmdReport) Invokes

func (c *CmdReport) Invokes() []string

type CmdRules

type CmdRules struct{}

func (*CmdRules) AdminRequired

func (c *CmdRules) AdminRequired() bool

func (*CmdRules) DMsAllowed

func (c *CmdRules) DMsAllowed() bool

func (*CmdRules) Description

func (c *CmdRules) Description() string

func (*CmdRules) Exec

func (c *CmdRules) Exec(ctx *Context) (err error)

func (*CmdRules) Invokes

func (c *CmdRules) Invokes() []string

type Command

type Command interface {
	Invokes() []string
	Description() string
	AdminRequired() bool
	DMsAllowed() bool
	Exec(ctx *Context) error
}

type CommandHandler

type CommandHandler struct {
	OnError func(err error, ctx *Context)
	// contains filtered or unexported fields
}

func NewCommandHandler

func NewCommandHandler(prefix string, db *gorm.DB) *CommandHandler

creates new instance of the commandhandler

func (*CommandHandler) HandleMessage

func (c *CommandHandler) HandleMessage(s *discordgo.Session, e *discordgo.MessageCreate)

message handler

func (*CommandHandler) RegisterCommand

func (c *CommandHandler) RegisterCommand(cmd Command)

easy way to add commands

func (*CommandHandler) RegisterMiddleware

func (c *CommandHandler) RegisterMiddleware(mw Middleware)

easy way to add middleware

type Context

type Context struct {
	Session  *discordgo.Session
	Message  *discordgo.Message
	Args     []string
	Handler  *CommandHandler
	Database *gorm.DB
}

type Handler

type Handler = func(*Context) error

type Middleware

type Middleware interface {
	Exec(ctx *Context, cmd Command) (next bool, err error)
}

Jump to

Keyboard shortcuts

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