bolt/command.go

26 lines
946 B
Go
Raw Permalink Normal View History

2025-06-04 16:00:53 -04:00
package bolt
import "time"
// custom Discord commands
2025-06-04 16:00:53 -04:00
type Command struct {
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
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
Roles []string //roles that can use command, if none are set anyone can run the command
2025-06-04 16:00:53 -04:00
}
// command payload functions, any strings returned are sent as a response to the command
type Payload func(msg Message) (string, error)
2025-06-04 16:00:53 -04:00
// message information passed to payload function
2025-06-04 16:00:53 -04:00
type Message struct {
Author string //username of message author
2025-06-25 19:12:34 -04:00
ID string //discord ID 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
Channel string //message channel
Server string //message guild
2025-06-04 16:00:53 -04:00
}