mirror of
https://github.com/diamondburned/cchat-discord.git
synced 2024-11-01 04:14:21 +00:00
25 lines
462 B
Go
25 lines
462 B
Go
package commands
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/diamondburned/cchat-discord/internal/discord/channel/shared"
|
|
)
|
|
|
|
type Command struct {
|
|
Name string
|
|
Args Arguments
|
|
Desc string
|
|
RunFunc func(shared.Channel, []string) ([]byte, error) // words[1:]
|
|
}
|
|
|
|
func (cmd Command) writeHelp(builder *bytes.Buffer) {
|
|
builder.WriteString(cmd.Name)
|
|
cmd.Args.writeHelp(builder)
|
|
|
|
if cmd.Desc != "" {
|
|
builder.WriteString("\n\t")
|
|
builder.WriteString(cmd.Desc)
|
|
}
|
|
}
|