131 lines
3.6 KiB
Go
131 lines
3.6 KiB
Go
package nechotron
|
|
|
|
import "github.com/NicoNex/echotron/v3"
|
|
|
|
type OptionsBuilder struct {
|
|
caption string
|
|
replyMarkup echotron.ReplyMarkup
|
|
parseMode echotron.ParseMode
|
|
entities []echotron.MessageEntity
|
|
messageThreadID int64
|
|
replyToMessageID int
|
|
disableWebPagePreview bool
|
|
disableNotification bool
|
|
protectContent bool
|
|
allowSendingWithoutReply bool
|
|
hasSpoiler bool
|
|
}
|
|
|
|
func NewOptions() *OptionsBuilder {
|
|
return &OptionsBuilder{}
|
|
}
|
|
|
|
func (o *OptionsBuilder) Caption(text string) *OptionsBuilder {
|
|
o.caption = text
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) ReplyMarkup(markup echotron.ReplyMarkup) *OptionsBuilder {
|
|
o.replyMarkup = markup
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) MarkdownV2() *OptionsBuilder {
|
|
o.parseMode = echotron.MarkdownV2
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) Spoiler() *OptionsBuilder {
|
|
o.hasSpoiler = true
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) Entities(entities []echotron.MessageEntity) *OptionsBuilder {
|
|
o.entities = entities
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) Thread(id int64) *OptionsBuilder {
|
|
o.messageThreadID = id
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) ReplyTo(id int) *OptionsBuilder {
|
|
o.replyToMessageID = id
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) DisableNotification() *OptionsBuilder {
|
|
o.disableNotification = true
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) ProtectContent() *OptionsBuilder {
|
|
o.protectContent = true
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) DisableWebPagePreview() *OptionsBuilder {
|
|
o.disableWebPagePreview = true
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) AllowSendingWithoutReply() *OptionsBuilder {
|
|
o.allowSendingWithoutReply = true
|
|
return o
|
|
}
|
|
|
|
func (o *OptionsBuilder) MessageOptions() *echotron.MessageOptions {
|
|
return &echotron.MessageOptions{
|
|
ReplyMarkup: o.replyMarkup,
|
|
ParseMode: o.parseMode,
|
|
Entities: o.entities,
|
|
MessageThreadID: o.messageThreadID,
|
|
ReplyToMessageID: o.replyToMessageID,
|
|
DisableWebPagePreview: o.allowSendingWithoutReply,
|
|
DisableNotification: o.disableNotification,
|
|
ProtectContent: o.protectContent,
|
|
AllowSendingWithoutReply: o.allowSendingWithoutReply,
|
|
}
|
|
}
|
|
|
|
func (o *OptionsBuilder) MessageTextOptions() *echotron.MessageTextOptions {
|
|
return &echotron.MessageTextOptions{
|
|
ReplyMarkup: o.replyMarkup.(echotron.InlineKeyboardMarkup),
|
|
ParseMode: o.parseMode,
|
|
Entities: o.entities,
|
|
DisableWebPagePreview: o.allowSendingWithoutReply,
|
|
}
|
|
}
|
|
|
|
func (o *OptionsBuilder) PhotoOptions() *echotron.PhotoOptions {
|
|
return &echotron.PhotoOptions{
|
|
ReplyMarkup: o.replyMarkup,
|
|
ParseMode: o.parseMode,
|
|
Caption: o.caption,
|
|
CaptionEntities: o.entities,
|
|
MessageThreadID: int(o.messageThreadID),
|
|
ReplyToMessageID: o.replyToMessageID,
|
|
HasSpoiler: o.hasSpoiler,
|
|
DisableNotification: o.disableNotification,
|
|
ProtectContent: o.protectContent,
|
|
AllowSendingWithoutReply: o.allowSendingWithoutReply,
|
|
}
|
|
}
|
|
|
|
func (o *OptionsBuilder) VideoOptions() *echotron.VideoOptions {
|
|
return &echotron.VideoOptions{
|
|
ReplyMarkup: o.replyMarkup,
|
|
ParseMode: o.parseMode,
|
|
Caption: o.caption,
|
|
CaptionEntities: o.entities,
|
|
SupportsStreaming: true,
|
|
MessageThreadID: int(o.messageThreadID),
|
|
ReplyToMessageID: o.replyToMessageID,
|
|
HasSpoiler: o.hasSpoiler,
|
|
DisableNotification: o.disableNotification,
|
|
ProtectContent: o.protectContent,
|
|
AllowSendingWithoutReply: o.allowSendingWithoutReply,
|
|
}
|
|
}
|