Documentation
¶
Index ¶
Constants ¶
const NoMessageToSend = "<NO_MESSAGE_TO_SEND>"
NoMessageToSend returned explicitly if we don't want to reply to user intput
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment interface {
AttachmentType() AttachmentType
}
Attachment to a bot message
type AttachmentType ¶
type AttachmentType int
AttachmentType to a bot message
const ( // AttachmentTypeNone says there is no attachment AttachmentTypeNone AttachmentType = iota // AttachmentTypeAudio is for audio attachments AttachmentTypeAudio // AttachmentTypeFile is for file attachments AttachmentTypeFile // AttachmentTypeImage is for image attachments AttachmentTypeImage // AttachmentTypeVideo is for video attachments AttachmentTypeVideo )
type BotAPISendMessageChannel ¶
type BotAPISendMessageChannel string
BotAPISendMessageChannel specifies messenger channel
type BotMessage ¶
type BotMessage interface {
BotMessageType() Type
}
BotMessage is an output message from bot to user
type ChatUID ¶
type ChatUID interface {
ChatUID() string
}
ChatUID returns botChat ID as unique string
type Format ¶
type Format int
Format specifies formatting of a text message to BOT (e.g. TypeText, HTML, MarkDown)
type MessageFromBot ¶
type MessageFromBot struct {
ResponseChannel BotAPISendMessageChannel `json:"-,omitempty"` // For debug purposes
ToChat ChatUID `json:",omitempty"`
// To be used with Telegram to edit an arbitrary message.
// Do not use this field directly when you want to edit the callback message
EditMessageIntID int `json:"editMessageIntID,omitempty"`
// This is a shortcut to MessageFromBot{}.BotMessage = TextMessageFromBot{text: "abc"}
TextMessageFromBot // TODO: This feels wrong and need to be refactored! Use BotMessage instead
BotMessage BotMessage `json:",omitempty"`
}
MessageFromBot keeps all the details of answer from bot to user
type MessageUID ¶
type MessageUID interface {
UID() string
}
MessageUID is unique message ID as string
type TextMessageFromBot ¶
type TextMessageFromBot struct {
Text string `json:",omitempty"`
Format Format `json:",omitempty"`
DisableWebPagePreview bool `json:",omitempty"`
DisableNotification bool `json:",omitempty"`
Keyboard botkb.Keyboard `json:",omitempty"`
IsEdit bool `json:",omitempty"`
EditMessageUID MessageUID `json:",omitempty"`
}
TextMessageFromBot is a text output message from bot to user
func (*TextMessageFromBot) BotEndpoint ¶
func (m *TextMessageFromBot) BotEndpoint() string
func (*TextMessageFromBot) BotMessageType ¶
func (m *TextMessageFromBot) BotMessageType() Type
Type returns if we want to send a new message or edit existing one
type Type ¶
type Type int
Type defines a type of output message from bot to user
const ( // TypeUndefined unknown type TypeUndefined Type = iota // TypeCallbackAnswer sends a callback answer TypeCallbackAnswer // BotMessageTypeInlineResults sends inline results BotMessageTypeInlineResults // TypeText sends text reply TypeText // TypeEditMessage edit previously sent message TypeEditMessage // TypeLeaveChat commands messenger to kick off bot from a botChat TypeLeaveChat // TypeExportChatInviteLink sends invite link TypeExportChatInviteLink TypeSendPhoto TypeSendInvoice TypeCreateInvoiceLink TypeAnswerPreCheckoutQuery TypeSetDescription TypeSetShortDescription TypeSetCommands )