Commands

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AboutCommand

func AboutCommand(ctx CommandContext, args []string) error

func HelpCommand

func HelpCommand(ctx CommandContext, args []string) error

func LoadTags

func LoadTags(f string, log *logrus.Logger)

func OwnerCommand

func OwnerCommand(ctx CommandContext, args []string) error

func PingCommand

func PingCommand(ctx CommandContext, args []string) error

func TagCommand

func TagCommand(ctx CommandContext, args []string) error

Types

type Command

type Command struct {
	Name            string
	Description     string
	OwnerOnly       bool
	Hidden          bool
	UserPermissions Shared.Permission
	BotPermissions  Shared.Permission
	Type            CommandType
	Run             CommandFunc
}

func NewAboutCommand

func NewAboutCommand() *Command

func NewHelpCommand

func NewHelpCommand() *Command

func NewOwnerCommand

func NewOwnerCommand() *Command

func NewPingCommand

func NewPingCommand() *Command

func NewTagCommand

func NewTagCommand() *Command

type CommandContext

type CommandContext struct {
	Session       *discordgo.Session
	Event         *discordgo.MessageCreate
	Manager       *CommandManager
	StatusManager *Status.StatusManager
	Message       *discordgo.Message
	User          *discordgo.User
	Channel       *discordgo.Channel
	Guild         *discordgo.Guild
	Member        *discordgo.Member
}

func (*CommandContext) Reply

func (ctx *CommandContext) Reply(message string) (*discordgo.Message, error)

func (*CommandContext) ReplyEmbed

func (ctx *CommandContext) ReplyEmbed(embed *discordgo.MessageEmbed) (*discordgo.Message, error)

func (*CommandContext) ReplyFile

func (ctx *CommandContext) ReplyFile(filename string, file io.Reader) (*discordgo.Message, error)

type CommandFunc

type CommandFunc func(CommandContext, []string) error

type CommandManager

type CommandManager struct {
	Prefixes      []string
	Owners        []string
	StatusManager *Status.StatusManager
	Logger        *logrus.Logger
	Commands      map[string]*Command
	IgnoreBots    bool
	OnErrorFunc   CommandManagerOnErrorFunc
}

func NewCommandManager

func NewCommandManager(c Configuration.Configuration, sm *Status.StatusManager, l *logrus.Logger, ignoreBots bool) CommandManager

func (*CommandManager) AddCommand

func (cmdm *CommandManager) AddCommand(cmd *Command)

func (*CommandManager) AddNewCommand

func (cmdm *CommandManager) AddNewCommand(name, desc string, owneronly, hidden bool, userperms, botperms Shared.Permission,
	cmdType CommandType, run CommandFunc)

func (*CommandManager) AddPrefix

func (cmdm *CommandManager) AddPrefix(prefix string)

func (*CommandManager) CommandHandler

func (cmdm *CommandManager) CommandHandler(s *discordgo.Session, m *discordgo.MessageCreate)

func (*CommandManager) GetPrefixes

func (cmdm *CommandManager) GetPrefixes() []string

func (*CommandManager) IsOwner

func (cmdm *CommandManager) IsOwner(id string) bool

func (*CommandManager) RemoveCommand

func (cmdm *CommandManager) RemoveCommand(name string)

func (*CommandManager) RemovePrefix

func (cmdm *CommandManager) RemovePrefix(prefix string)

func (*CommandManager) SetPrefixes

func (cmdm *CommandManager) SetPrefixes(prefixes []string)

type CommandManagerOnErrorFunc

type CommandManagerOnErrorFunc func(cmdm *CommandManager, err error)

type CommandType

type CommandType int
const (
	CommandTypePM CommandType = iota
	CommandTypeGuild
	CommandTypeEverywhere
)

Jump to

Keyboard shortcuts

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