forked from pothtonswer/discordmuffin
296 lines
7.2 KiB
Go
296 lines
7.2 KiB
Go
package discordgo
|
|
|
|
import "time"
|
|
|
|
// MessageEmbedBuilder creates a new MessageEmbed struct.
|
|
func MessageEmbedBuilder() *MessageEmbed {
|
|
return &MessageEmbed{}
|
|
}
|
|
|
|
// SetTitle sets title for MessageEmbed.
|
|
func (b *MessageEmbed) SetTitle(title string) *MessageEmbed {
|
|
b.Title = title
|
|
return b
|
|
}
|
|
|
|
// SetDescription sets description for MessageEmbed.
|
|
func (b *MessageEmbed) SetDescription(desc string) *MessageEmbed {
|
|
b.Description = desc
|
|
return b
|
|
}
|
|
|
|
// SetColor sets color for MessageEmbed.
|
|
func (b *MessageEmbed) SetColor(color int) *MessageEmbed {
|
|
b.Color = color
|
|
return b
|
|
}
|
|
|
|
// SetThumbnail sets thumbnail for MessageEmbed.
|
|
func (b *MessageEmbed) SetThumbnail(url string) *MessageEmbed {
|
|
b.Thumbnail = &MessageEmbedThumbnail{URL: url}
|
|
return b
|
|
}
|
|
|
|
// SetImage sets image for MessageEmbed.
|
|
func (b *MessageEmbed) SetImage(url string) *MessageEmbed {
|
|
b.Image = &MessageEmbedImage{URL: url}
|
|
return b
|
|
}
|
|
|
|
// SetTimestamp sets timestamp for MessageEmbed.
|
|
func (b *MessageEmbed) SetTimestamp(times time.Time) *MessageEmbed {
|
|
b.Timestamp = times.Format(time.RFC3339)
|
|
return b
|
|
}
|
|
|
|
// SetFooter sets footer for MessageEmbed.
|
|
func (b *MessageEmbed) SetFooter(footer MessageEmbedFooter) *MessageEmbed {
|
|
b.Footer = &footer
|
|
return b
|
|
}
|
|
|
|
// AddFields adds fields for MessageEmbed.
|
|
func (b *MessageEmbed) AddFields(fields ...*MessageEmbedField) *MessageEmbed {
|
|
b.Fields = fields
|
|
return b
|
|
}
|
|
|
|
// SetAuthor sets author for MessageEmbed.
|
|
func (b *MessageEmbed) SetAuthor(author MessageEmbedAuthor) *MessageEmbed {
|
|
b.Author = &author
|
|
return b
|
|
}
|
|
|
|
// SetURL sets url for MessageEmbed.
|
|
func (b *MessageEmbed) SetURL(url string) *MessageEmbed {
|
|
b.URL = url
|
|
return b
|
|
}
|
|
|
|
// ActionRowBuilder creates new ActionRow struct.
|
|
func ActionRowBuilder() *ActionsRow {
|
|
return &ActionsRow{}
|
|
}
|
|
|
|
// AddComponents adds components for MessageComponent.
|
|
func (r *ActionsRow) AddComponents(components ...MessageComponent) {
|
|
r.Components = append(r.Components, components...)
|
|
}
|
|
|
|
// ButtonBuilder creates new Button struct.
|
|
func ButtonBuilder() *Button {
|
|
return &Button{}
|
|
}
|
|
|
|
// SetCustomID sets customID for Button.
|
|
func (b *Button) SetCustomID(customID string) *Button {
|
|
b.CustomID = customID
|
|
return b
|
|
}
|
|
|
|
// SetLabel sets label for Button.
|
|
func (b *Button) SetLabel(label string) *Button {
|
|
b.Label = label
|
|
return b
|
|
}
|
|
|
|
// SetStyle sets style for Button.
|
|
func (b *Button) SetStyle(style ButtonStyle) *Button {
|
|
b.Style = style
|
|
return b
|
|
}
|
|
|
|
// SetEmoji sets emoji for Button.
|
|
func (b *Button) SetEmoji(emoji ComponentEmoji) *Button {
|
|
b.Emoji = &emoji
|
|
return b
|
|
}
|
|
|
|
// SetURL sets URL for Button.
|
|
func (b *Button) SetURL(url string) *Button {
|
|
b.URL = url
|
|
return b
|
|
}
|
|
|
|
// SetDisabled sets disabled for Button.
|
|
func (b *Button) SetDisabled(disabled bool) *Button {
|
|
b.Disabled = disabled
|
|
return b
|
|
}
|
|
|
|
// SetSKUID sets sku id for Button.
|
|
func (b *Button) SetSKUID(skuID string) *Button {
|
|
b.SKUID = skuID
|
|
return b
|
|
}
|
|
|
|
// SelectMenuBuilder creates a new SelectMenu struct.
|
|
func SelectMenuBuilder(menuType SelectMenuType) *SelectMenu {
|
|
return &SelectMenu{MenuType: menuType}
|
|
}
|
|
|
|
// SetCustomID sets customID for SelectMenu.
|
|
func (s *SelectMenu) SetCustomID(customID string) *SelectMenu {
|
|
s.CustomID = customID
|
|
return s
|
|
}
|
|
|
|
// AddOptions adds options for SelectMenu.
|
|
// NOTE: It can be used in string SelectMenu.
|
|
func (s *SelectMenu) AddOptions(options ...SelectMenuOption) *SelectMenu {
|
|
s.Options = append(s.Options, options...)
|
|
return s
|
|
}
|
|
|
|
// SetPlaceholder sets placeholder for SelectMenu.
|
|
func (s *SelectMenu) SetPlaceholder(placeholder string) *SelectMenu {
|
|
s.Placeholder = placeholder
|
|
return s
|
|
}
|
|
|
|
// SetMinValues sets min values for SelectMenu.
|
|
func (s *SelectMenu) SetMinValues(minValues int) *SelectMenu {
|
|
s.MinValues = &minValues
|
|
return s
|
|
}
|
|
|
|
// SetMaxValues sets max values for SelectMenu.
|
|
func (s *SelectMenu) SetMaxValues(maxValues int) *SelectMenu {
|
|
s.MaxValues = maxValues
|
|
return s
|
|
}
|
|
|
|
// SetDisabled sets disabled for SelectMenu.
|
|
func (s *SelectMenu) SetDisabled(disabled bool) *SelectMenu {
|
|
s.Disabled = disabled
|
|
return s
|
|
}
|
|
|
|
// AddDefaultValues adds default values for SelectMenu.
|
|
// NOTE: It can not be used in string SelectMenu.
|
|
func (s *SelectMenu) AddDefaultValues(defaultValues ...SelectMenuDefaultValue) *SelectMenu {
|
|
s.DefaultValues = append(s.DefaultValues, defaultValues...)
|
|
return s
|
|
}
|
|
|
|
// SelectMenuOptionBuilder creates a new SelectMenuOption struct.
|
|
func SelectMenuOptionBuilder() *SelectMenuOption {
|
|
return &SelectMenuOption{}
|
|
}
|
|
|
|
// SetLabel sets label for SelectMenuOption.
|
|
func (o *SelectMenuOption) SetLabel(label string) *SelectMenuOption {
|
|
o.Label = label
|
|
return o
|
|
}
|
|
|
|
// SetValue sets value for SelectMenuOption.
|
|
func (o *SelectMenuOption) SetValue(value string) *SelectMenuOption {
|
|
o.Value = value
|
|
return o
|
|
}
|
|
|
|
// SetDescription sets description for SelectMenuOption.
|
|
func (o *SelectMenuOption) SetDescription(desc string) *SelectMenuOption {
|
|
o.Description = desc
|
|
return o
|
|
}
|
|
|
|
// SetEmoji sets emoji for SelectMenuOption.
|
|
func (o *SelectMenuOption) SetEmoji(emoji ComponentEmoji) *SelectMenuOption {
|
|
o.Emoji = &emoji
|
|
return o
|
|
}
|
|
|
|
// SetDefault sets default for SelectMenuOption.
|
|
func (o *SelectMenuOption) SetDefault(optionDefault bool) *SelectMenuOption {
|
|
o.Default = optionDefault
|
|
return o
|
|
}
|
|
|
|
// SelectMenuDefaultValueBuilder creates a new SelectMenuDefaultValue struct.
|
|
func SelectMenuDefaultValueBuilder(valueType SelectMenuDefaultValueType) *SelectMenuDefaultValue {
|
|
return &SelectMenuDefaultValue{Type: valueType}
|
|
}
|
|
|
|
// SetID sets ID for SelectMenuDefaultValue.
|
|
func (d *SelectMenuDefaultValue) SetID(id string) *SelectMenuDefaultValue {
|
|
d.ID = id
|
|
return d
|
|
}
|
|
|
|
// ComponentEmojiBuilder creates a new ComponentEmoji struct.
|
|
func ComponentEmojiBuilder() *ComponentEmoji {
|
|
return &ComponentEmoji{}
|
|
}
|
|
|
|
// SetID sets ID for ComponentEmoji.
|
|
func (c *ComponentEmoji) SetID(id string) *ComponentEmoji {
|
|
c.ID = id
|
|
return c
|
|
}
|
|
|
|
// SetName sets name for ComponentEmoji.
|
|
func (c *ComponentEmoji) SetName(name string) *ComponentEmoji {
|
|
c.Name = name
|
|
return c
|
|
}
|
|
|
|
// SetAnimated sets animated for ComponentEmoji.
|
|
func (c *ComponentEmoji) SetAnimated(animated bool) *ComponentEmoji {
|
|
c.Animated = animated
|
|
return c
|
|
}
|
|
|
|
// TextInputBuilder creates a new TextInput struct.
|
|
func TextInputBuilder() *TextInput {
|
|
return &TextInput{}
|
|
}
|
|
|
|
// SetCustomID sets customID for TextInput.
|
|
func (t *TextInput) SetCustomID(customID string) *TextInput {
|
|
t.CustomID = customID
|
|
return t
|
|
}
|
|
|
|
// SetStyle sets style for TextInput.
|
|
func (t *TextInput) SetStyle(style TextInputStyle) *TextInput {
|
|
t.Style = style
|
|
return t
|
|
}
|
|
|
|
// SetLabel sets label for TextInput.
|
|
func (t *TextInput) SetLabel(label string) *TextInput {
|
|
t.Label = label
|
|
return t
|
|
}
|
|
|
|
// SetMinLength sets min length for TextInput.
|
|
func (t *TextInput) SetMinLength(minLength int) *TextInput {
|
|
t.MinLength = minLength
|
|
return t
|
|
}
|
|
|
|
// SetMaxLength sets max length for TextInput.
|
|
func (t *TextInput) SetMaxLength(maxLength int) *TextInput {
|
|
t.MaxLength = maxLength
|
|
return t
|
|
}
|
|
|
|
// SetRequired sets required for TextInput.
|
|
func (t *TextInput) SetRequired(required bool) *TextInput {
|
|
t.Required = required
|
|
return t
|
|
}
|
|
|
|
// SetValue sets value for TextInput.
|
|
func (t *TextInput) SetValue(value string) *TextInput {
|
|
t.Value = value
|
|
return t
|
|
}
|
|
|
|
// SetPlaceholder sets placeholder for TextInput.
|
|
func (t *TextInput) SetPlaceholder(placeholder string) *TextInput {
|
|
t.Placeholder = placeholder
|
|
return t
|
|
}
|