2025-06-04 16:00:53 -04:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
2025-06-08 02:26:06 -04:00
|
|
|
// custom Discord commands
|
2025-06-04 16:00:53 -04:00
|
|
|
type Command struct {
|
2025-06-04 18:28:27 -04:00
|
|
|
Trigger string //command that triggers payload NOT including the indicator
|
2025-06-04 16:00:53 -04:00
|
|
|
Payload Payload //payload function to run when a command is detected
|
2025-06-08 02:26:06 -04:00
|
|
|
Timeout time.Duration //the amount of time before command can be run again
|
2025-06-07 00:34:26 -04:00
|
|
|
lastRun time.Time //timestamp of last command run
|
2025-06-08 02:26:06 -04:00
|
|
|
Roles []string //roles that can use command, if none are set anyone can run the command
|
2025-06-04 16:00:53 -04:00
|
|
|
}
|
|
|
|
|
2025-06-08 02:26:06 -04:00
|
|
|
// command payload functions, any strings returned are sent as a response to the command
|
2025-06-04 23:22:10 -04:00
|
|
|
type Payload func(msg Message) (string, error)
|
2025-06-04 16:00:53 -04:00
|
|
|
|
2025-06-08 02:26:06 -04:00
|
|
|
// message information passed to payload function
|
2025-06-04 16:00:53 -04:00
|
|
|
type Message struct {
|
2025-06-04 16:47:50 -04:00
|
|
|
Author string //username of message author
|
2025-06-04 16:00:53 -04:00
|
|
|
Words []string //words from message split on whitespace
|
2025-06-04 23:15:00 -04:00
|
|
|
Content string //entire message content
|
2025-06-08 02:26:06 -04:00
|
|
|
Channel string //message channel
|
|
|
|
Server string //message guild
|
2025-06-04 16:00:53 -04:00
|
|
|
}
|