- bolt will now ensure role is present before exec payload - readme updates - removed author struct since roles are checked in bolt framework
25 lines
955 B
Go
25 lines
955 B
Go
package bolt
|
|
|
|
import "time"
|
|
|
|
type Command struct {
|
|
Trigger string //.command that triggers payload INCLUDING the '.'
|
|
Payload Payload //payload function to run when a command is detected
|
|
Timeout time.Duration //the amount of time before command can run again
|
|
LastRun time.Time //timestamp of last command run
|
|
Roles []string //roles that can use command
|
|
}
|
|
|
|
// payload function type handling commands. The returned error is parsed and, if no error,
|
|
// is detected then the response string (res) will be sent in response to the command message
|
|
type Payload func(msg Message) (res string, err error)
|
|
|
|
// contains the basic information needed for a message command
|
|
type Message struct {
|
|
Author string //username of message author
|
|
Words []string //words from message split on whitespace
|
|
Message string //entire message content
|
|
Channel string //channel message was sent in
|
|
Server string //guild message was sent in
|
|
}
|