25 lines
956 B
Go
25 lines
956 B
Go
package bolt
|
|
|
|
import "time"
|
|
|
|
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 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) (string, 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
|
|
Content string //entire message content
|
|
Channel string //channel message was sent in
|
|
Server string //guild message was sent in
|
|
}
|