commands

package
v0.0.0-...-c347dc3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DISCORD_MSG_MAX_LEN = 2000
View Source
const GROUP_COMMANDS = `group:"commands"`

Variables

Functions

func AsCommand

func AsCommand(in any) any

func HasCommandPrefix

func HasCommandPrefix(trigger string, command string, message string) bool

func SplitArgs

func SplitArgs(s string) []string

func StripPrefix

func StripPrefix(trigger string, command string) func(string) string

Strip the prefix from a command

Types

type BijnaWeekendCommand

type BijnaWeekendCommand struct{}

func NewBijnaWeekendCommand

func NewBijnaWeekendCommand() *BijnaWeekendCommand

func (*BijnaWeekendCommand) Apply

func (b *BijnaWeekendCommand) Apply(ctx *Context) error

func (*BijnaWeekendCommand) Name

func (b *BijnaWeekendCommand) Name() string

func (*BijnaWeekendCommand) SkipsPrefix

func (b *BijnaWeekendCommand) SkipsPrefix() bool

type Command

type Command interface {
	Name() string
	Apply(*Context) error
	SkipsPrefix() bool
}

type Context

type Context struct {
	Message *discordgo.Message
	Content string
	Args    []string
	Session *discordgo.Session
}

func (*Context) Error

func (ctx *Context) Error(err error) (*discordgo.Message, error)

func (*Context) Reference

func (ctx *Context) Reference() *discordgo.MessageReference

func (*Context) Reply

func (ctx *Context) Reply(s string) (*discordgo.Message, error)

func (*Context) ReplyList

func (ctx *Context) ReplyList(s []string) ([]*discordgo.Message, error)

type Executor

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

func NewCommandExecutor

func NewCommandExecutor(commands []Command, log *zap.Logger) *Executor

func (*Executor) Apply

func (e *Executor) Apply(trigger string, message *discordgo.Message, s *discordgo.Session)

func (*Executor) HasMatch

func (e *Executor) HasMatch(trigger string, message string) bool

type FuehrerWeekend

type FuehrerWeekend struct{}

func NewFuehrerWeekend

func NewFuehrerWeekend() *FuehrerWeekend

func (*FuehrerWeekend) Apply

func (b *FuehrerWeekend) Apply(ctx *Context) error

func (*FuehrerWeekend) Name

func (f *FuehrerWeekend) Name() string

func (*FuehrerWeekend) SkipsPrefix

func (f *FuehrerWeekend) SkipsPrefix() bool

type JoinCommand

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

func NewJoinCommand

func NewJoinCommand(repo *repositories.GuildRepository) *JoinCommand

func (*JoinCommand) Apply

func (j *JoinCommand) Apply(ctx *Context) error

func (*JoinCommand) Name

func (j *JoinCommand) Name() string

func (*JoinCommand) SkipsPrefix

func (j *JoinCommand) SkipsPrefix() bool

type ListCommand

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

func NewListCommand

func NewListCommand(store *soundstore.SoundStore) *ListCommand

func (*ListCommand) Apply

func (l *ListCommand) Apply(ctx *Context) error

func (*ListCommand) Name

func (l *ListCommand) Name() string

func (*ListCommand) SkipsPrefix

func (l *ListCommand) SkipsPrefix() bool

type MonkeyWeekend

type MonkeyWeekend struct{}

func NewMonkeyWeekend

func NewMonkeyWeekend() *MonkeyWeekend

func (*MonkeyWeekend) Apply

func (b *MonkeyWeekend) Apply(ctx *Context) error

func (*MonkeyWeekend) Name

func (f *MonkeyWeekend) Name() string

func (*MonkeyWeekend) SkipsPrefix

func (f *MonkeyWeekend) SkipsPrefix() bool

type PSCommand

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

func NewPSCommand

func NewPSCommand(repo *repositories.GuildRepository, queue *queues.SoundsQueue) *PSCommand

func (*PSCommand) Apply

func (ps *PSCommand) Apply(ctx *Context) error

func (*PSCommand) Name

func (ps *PSCommand) Name() string

func (*PSCommand) SkipsPrefix

func (p *PSCommand) SkipsPrefix() bool

type SaveCommand

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

func NewSaveCommand

func NewSaveCommand(l *zap.Logger, saver *saver.Saver, metrics *metrics.MetricsCollector) *SaveCommand

func (*SaveCommand) Apply

func (s *SaveCommand) Apply(ctx *Context) error

func (*SaveCommand) Name

func (s *SaveCommand) Name() string

func (*SaveCommand) SkipsPrefix

func (s *SaveCommand) SkipsPrefix() bool

type SetPrefixCommand

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

func (*SetPrefixCommand) Apply

func (s *SetPrefixCommand) Apply(ctx *Context) error

func (*SetPrefixCommand) Name

func (s *SetPrefixCommand) Name() string

func (*SetPrefixCommand) SkipsPrefix

func (s *SetPrefixCommand) SkipsPrefix() bool

Jump to

Keyboard shortcuts

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