-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand_builder_impl_options.go
64 lines (50 loc) · 2.02 KB
/
command_builder_impl_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package router
import "github.com/Postcord/objects"
// StringChoice is used to define a choice of the string type.
type StringChoice struct {
// Name is the name of the choice.
Name string `json:"name"`
// Value is the string that is the resulting value.
Value string `json:"value"`
}
// IntChoice is used to define a choice of the int type.
type IntChoice struct {
// Name is the name of the choice.
Name string `json:"name"`
// Value is the int that is the resulting value.
Value int `json:"value"`
}
// DoubleChoice is used to define a choice of the double type.
type DoubleChoice struct {
// Name is the name of the choice.
Name string `json:"name"`
// Value is the double that is the resulting value.
Value float64 `json:"value"`
}
func (c *commandBuilder[T]) appendOption(type_ objects.ApplicationCommandOptionType, name, description string, required bool) T {
c.cmd.Options = append(c.cmd.Options, &objects.ApplicationCommandOption{
OptionType: type_,
Name: name,
Description: description,
Required: required,
})
return builderWrapify(c)
}
func (c *commandBuilder[T]) BoolOption(name, description string, required bool) T {
return c.appendOption(objects.TypeBoolean, name, description, required)
}
func (c *commandBuilder[T]) UserOption(name, description string, required bool) T {
return c.appendOption(objects.TypeUser, name, description, required)
}
func (c *commandBuilder[T]) ChannelOption(name, description string, required bool) T {
return c.appendOption(objects.TypeChannel, name, description, required)
}
func (c *commandBuilder[T]) RoleOption(name, description string, required bool) T {
return c.appendOption(objects.TypeRole, name, description, required)
}
func (c *commandBuilder[T]) MentionableOption(name, description string, required bool) T {
return c.appendOption(objects.TypeMentionable, name, description, required)
}
func (c *commandBuilder[T]) AttachmentOption(name, description string, required bool) T {
return c.appendOption(objects.TypeAttachment, name, description, required)
}