bolt/command.go

25 lines
955 B
Go
Raw Normal View History

2025-06-04 16:00:53 -04:00
package bolt
import "time"
type Command struct {
2025-06-04 16:15:56 -04:00
Trigger string //.command that triggers payload INCLUDING the '.'
2025-06-04 16:00:53 -04:00
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
2025-06-04 16:00:53 -04:00
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
}