commands

package
v0.0.0-...-47431a5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MemberRoleID  = "416353375647432706"
	AcademyRoleID = "488400983836196874"
	OfficerRoleID = "382256632882659338"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	CallPhrase string
	// alternative callphrases TODO: always top-level?
	Aliases    []string
	Permission Permission
	// TODO: doc
	SubCommands     []Command
	HelpDescription string
	Handler         Handler
	// Init is called before the handler. Put it as nil if there's no need.
	Init Init
	Help Help
}

type Handler

type Handler func(msg string, s *discordgo.Session, m *discordgo.MessageCreate, db *sql.DB, guildID string, cmds []Command)

Handler of message sent events. TODO: Jesus past me, this can't be the best way to do it

type Help

type Help struct {
	// Summary of what the command does in a short sentence.
	Summary string
	// DetailedDescription of what the command does.
	DetailedDescription string
	// Syntax shows how to use the command.
	// Leave this empty if there is no particular functionality in the main command, but instead in the subcommands.
	// Do not include a prefix (e.g. an exclamation mark).
	Syntax string
	// Example of how to use the command.
	// Leave this empty if there is no particular functionality in the main command, but instead in the subcommands.
	// Do not include a prefix (e.g. an exclamation mark).
	Example string
	// SubCommands contains the callphrase mapped to their own Help object.
	SubCommands map[string]Help // TODO: Finish implementing this, consider using a slice instead
}

Help with information about what the Command does and how to use it.

type Init

type Init func(s *discordgo.Session, db *sql.DB)

type Permission

type Permission int
const (
	All Permission = iota
	Members
	Officers
)

func (Permission) Authorized

func (p Permission) Authorized(user discordgo.Member) bool

Authorized returns whether the member is authorized to use the command.

Jump to

Keyboard shortcuts

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