bolt/command.go

26 lines
946 B
Go

package bolt
import "time"
// custom Discord commands
type Command struct {
Trigger string //command that triggers payload NOT including the indicator
Payload Payload //payload function to run when a command is detected
Timeout time.Duration //the amount of time before command can be run again
lastRun time.Time //timestamp of last command run
Roles []string //roles that can use command, if none are set anyone can run the command
}
// command payload functions, any strings returned are sent as a response to the command
type Payload func(msg Message) (string, error)
// message information passed to payload function
type Message struct {
Author string //username of message author
ID string //discord ID of message author
Words []string //words from message split on whitespace
Content string //entire message content
Channel string //message channel
Server string //message guild
}