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 AnswerCallbackQuery ¶ added in v0.68.0
type AnswerCallbackQuery struct {
CallbackQueryID string `json:"callback_query_id"` // Unique identifier for the query to be answered
// Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
Text string `json:"text,omitempty"`
// If True, an alert will be shown by the client instead of a notification at the top of the chat screen
ShowAlert bool `json:"show_alert,omitempty"`
// URL that will be opened by the user's client.
// If you have created a Game and accepted the conditions via @BotFather,
// specify the URL that opens your game - note that this will only work
// if the query comes from a callback_game button.
//
// Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
URL string `json:"url,omitempty"`
// The maximum amount of time in seconds that the result of the callback query may be cached client-side.
// Telegram apps will support caching starting in version 3.14. Defaults to 0.
CacheTime int `json:"cache_time,omitempty"`
}
AnswerCallbackQuery is modeled after https://core.telegram.org/bots/api#answercallbackquery
func (AnswerCallbackQuery) BotMessageType ¶ added in v0.68.0
func (AnswerCallbackQuery) BotMessageType() Type
func (AnswerCallbackQuery) Validate ¶ added in v0.68.0
func (v AnswerCallbackQuery) Validate() error
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"`
Analytics analytics.Message
}
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
BotMessageType 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 )