Documentation
¶
Index ¶
- Constants
- Variables
- func BaseTgChatDtoMaker(botID string) (botChat botsfwmodels.BotChatData, err error)
- func BaseTgUserDtoMaker(botID string) (botsfwmodels.PlatformUserData, error)
- func EditMessageOnCallbackQuery(whcbq botinput.CallbackQuery, parseMode, text string) *tgbotapi.EditMessageTextConfig
- func GetTelegramBotAPIClient(ctx context.Context, botContext botsfw.BotContext) *tgbotapi.BotAPI
- func NewBotRecordsFieldsSetter(...) botsfw.BotRecordsFieldsSetter
- func NewTelegramBot(environment string, profile botsfw.BotProfile, ...) botsfw.BotSettings
- func NewTelegramChatInstance(chatInstanceID string, chatID int64, preferredLanguage string) (tgChatInstanceData botsfwtgmodels.TgChatInstanceData)
- func NewTelegramWebhookHandler(botContextProvider botsfw.BotContextProvider, ...) botsfw.WebhookHandler
- func NewTelegramWebhookInput(update *tgbotapi.Update, logRequest func()) (botinput.InputMessage, error)
- func NewTgChatInstanceKey(botCode, chatInstanceID string) *dal.Key
- type CallbackAnswer
- type ChatMessageUID
- type DataStore
- type ExportChatInviteLink
- type InlineBotMessage
- type InlineMessageUID
- type Invoice
- type LeaveChat
- type MessageType
- type PreCheckoutQueryAnswer
- type SendPhoto
- type SetBotCommands
- type SetBotDescription
- type SetBotShortDescription
- type TgChat
- type TgChatInstance
- type TgChatInstanceDal
- type TgWebhookInlineQuery
- func (iq TgWebhookInlineQuery) BotChatID() (string, error)
- func (whi TgWebhookInlineQuery) Chat() botinput.Chat
- func (iq TgWebhookInlineQuery) GetFrom() botinput.Sender
- func (whi TgWebhookInlineQuery) GetID() interface{}
- func (iq TgWebhookInlineQuery) GetInlineQueryID() string
- func (iq TgWebhookInlineQuery) GetOffset() string
- func (iq TgWebhookInlineQuery) GetQuery() string
- func (whi TgWebhookInlineQuery) GetRecipient() botinput.Recipient
- func (whi TgWebhookInlineQuery) GetSender() botinput.User
- func (whi TgWebhookInlineQuery) GetTime() time.Time
- func (whi TgWebhookInlineQuery) InputType() botinput.Type
- func (whi TgWebhookInlineQuery) LogRequest()
- func (whi TgWebhookInlineQuery) MessageIntID() int
- func (whi TgWebhookInlineQuery) MessageStringID() string
- func (whi TgWebhookInlineQuery) TelegramChatID() int64
- func (whi TgWebhookInlineQuery) TgUpdate() *tgbotapi.Update
- type TgWebhookInput
- type WebhookCallbackQuery
Constants ¶
const ( // MessageTypeRegular is 'message' MessageTypeRegular = "message" // MessageTypeEdited is 'edited_message' MessageTypeEdited = "edited_message" // MessageTypeChannelPost is 'channel_post' MessageTypeChannelPost = "channel_post" // MessageTypeEditedChannelPost is 'edited_channel_post' MessageTypeEditedChannelPost = "edited_channel_post" )
const ChatInstancesCollection = "chatInstances"
const PlatformID botsfwconst.Platform = "telegram"
PlatformID is 'telegram'
Variables ¶
var CallbackCurrent botmsg.MessageUID = &callbackCurrent{}
CallbackCurrent is what?
var NewChatInstanceData = func(botCode string) botsfwtgmodels.TgChatInstanceData { panic("telegram.NewChatInstanceData is not set") }
var Platform botsfw.BotPlatform = platform{}
Platform is a bots platform descriptor (in this case - for Telegram)
Functions ¶
func BaseTgChatDtoMaker ¶
func BaseTgChatDtoMaker(botID string) (botChat botsfwmodels.BotChatData, err error)
func BaseTgUserDtoMaker ¶
func BaseTgUserDtoMaker(botID string) (botsfwmodels.PlatformUserData, error)
func EditMessageOnCallbackQuery ¶
func EditMessageOnCallbackQuery(whcbq botinput.CallbackQuery, parseMode, text string) *tgbotapi.EditMessageTextConfig
EditMessageOnCallbackQuery creates edit message
func GetTelegramBotAPIClient ¶ added in v0.20.0
func NewBotRecordsFieldsSetter ¶
func NewBotRecordsFieldsSetter( setAppUserFields func(appUser botsfwmodels.AppUserData, sender botinput.Sender) error, ) botsfw.BotRecordsFieldsSetter
func NewTelegramBot ¶
func NewTelegramBot( environment string, profile botsfw.BotProfile, code, token, paymentTestToken, paymentToken, gaToken string, locale i18n.Locale, getDatabase botsfw.DbGetter, getAppUser botsfw.AppUserGetter, ) botsfw.BotSettings
NewTelegramBot creates definition of new telegram bot
func NewTelegramChatInstance ¶ added in v0.19.0
func NewTelegramChatInstance(chatInstanceID string, chatID int64, preferredLanguage string) (tgChatInstanceData botsfwtgmodels.TgChatInstanceData)
func NewTelegramWebhookHandler ¶
func NewTelegramWebhookHandler( botContextProvider botsfw.BotContextProvider, translatorProvider botsfw.TranslatorProvider, setAppUserFields func(botsfwmodels.AppUserData, botinput.Sender) error, ) botsfw.WebhookHandler
NewTelegramWebhookHandler creates new Telegram webhooks handler
func NewTelegramWebhookInput ¶
func NewTelegramWebhookInput(update *tgbotapi.Update, logRequest func()) (botinput.InputMessage, error)
NewTelegramWebhookInput maps telegram update struct to bots framework interface
func NewTgChatInstanceKey ¶ added in v0.19.0
Types ¶
type CallbackAnswer ¶
type CallbackAnswer tgbotapi.AnswerCallbackQueryConfig
CallbackAnswer is a callback answer message
func (CallbackAnswer) BotEndpoint ¶ added in v0.20.0
func (a CallbackAnswer) BotEndpoint() string
func (CallbackAnswer) BotMessageType ¶
func (CallbackAnswer) BotMessageType() botmsg.Type
BotMessageType returns BotMessageTypeCallbackAnswer
type ChatMessageUID ¶
ChatMessageUID is what?
func GetMessageUID ¶ added in v0.17.0
func GetMessageUID(whc botsfw.WebhookContext) (*ChatMessageUID, error)
GetMessageUID returns UID of the message to be edited
func NewChatMessageUID ¶
func NewChatMessageUID(chatID int64, messageID int) *ChatMessageUID
NewChatMessageUID create new ChatMessageUID
func (ChatMessageUID) GetChatID ¶ added in v0.25.0
func (m ChatMessageUID) GetChatID() int64
func (ChatMessageUID) GetMessageID ¶ added in v0.25.0
func (m ChatMessageUID) GetMessageID() int
func (ChatMessageUID) UID ¶
func (m ChatMessageUID) UID() string
UID return unique ID of the message
type DataStore ¶
type DataStore interface {
TgChatInstanceDal
}
type ExportChatInviteLink ¶
type ExportChatInviteLink tgbotapi.ExportChatInviteLink
ExportChatInviteLink is a TG message
func (ExportChatInviteLink) BotEndpoint ¶ added in v0.20.0
func (m ExportChatInviteLink) BotEndpoint() string
func (ExportChatInviteLink) BotMessageType ¶
func (ExportChatInviteLink) BotMessageType() botmsg.Type
BotMessageType returns BotMessageTypeExportChatInviteLink
type InlineBotMessage ¶
type InlineBotMessage tgbotapi.InlineConfig
InlineBotMessage is a wrapper for Telegram bot message
func (InlineBotMessage) BotEndpoint ¶ added in v0.20.0
func (m InlineBotMessage) BotEndpoint() string
func (InlineBotMessage) BotMessageType ¶
func (InlineBotMessage) BotMessageType() botmsg.Type
BotMessageType returns BotMessageTypeInlineResults
type InlineMessageUID ¶
type InlineMessageUID struct {
InlineMessageID string
}
InlineMessageUID is inline message UID
func NewInlineMessageUID ¶
func NewInlineMessageUID(inlineMessageID string) *InlineMessageUID
NewInlineMessageUID creates new inline message UID
func (InlineMessageUID) UID ¶
func (m InlineMessageUID) UID() string
UID is unique ID of the message
type Invoice ¶ added in v0.20.0
type Invoice tgbotapi.InvoiceConfig
func (Invoice) BotEndpoint ¶ added in v0.20.0
func (Invoice) BotMessageType ¶ added in v0.20.0
type LeaveChat ¶
type LeaveChat tgbotapi.LeaveChatConfig
LeaveChat is a leave chat message from bot
func (LeaveChat) BotEndpoint ¶ added in v0.20.0
func (LeaveChat) BotMessageType ¶
BotMessageType return BotMessageTypeLeaveChat
type MessageType ¶ added in v0.24.0
type MessageType string
MessageType represents tpye of Telegram message
type PreCheckoutQueryAnswer ¶ added in v0.20.0
type PreCheckoutQueryAnswer tgbotapi.AnswerPreCheckoutQueryConfig
func (PreCheckoutQueryAnswer) BotMessageType ¶ added in v0.20.0
func (PreCheckoutQueryAnswer) BotMessageType() botmsg.Type
type SendPhoto ¶ added in v0.21.0
type SendPhoto tgbotapi.PhotoConfig
func (SendPhoto) BotEndpoint ¶ added in v0.21.0
func (SendPhoto) BotMessageType ¶ added in v0.21.0
type SetBotCommands ¶ added in v0.20.0
type SetBotCommands tgbotapi.SetMyCommandsConfig
func (SetBotCommands) BotEndpoint ¶ added in v0.20.0
func (m SetBotCommands) BotEndpoint() string
func (SetBotCommands) BotMessageType ¶ added in v0.20.0
func (SetBotCommands) BotMessageType() botmsg.Type
type SetBotDescription ¶ added in v0.20.0
type SetBotDescription tgbotapi.SetMyDescription
func (SetBotDescription) BotEndpoint ¶ added in v0.20.0
func (m SetBotDescription) BotEndpoint() string
func (SetBotDescription) BotMessageType ¶ added in v0.20.0
func (SetBotDescription) BotMessageType() botmsg.Type
type SetBotShortDescription ¶ added in v0.20.0
type SetBotShortDescription tgbotapi.SetMyShortDescription
func (SetBotShortDescription) BotEndpoint ¶ added in v0.20.0
func (m SetBotShortDescription) BotEndpoint() string
func (SetBotShortDescription) BotMessageType ¶ added in v0.20.0
func (SetBotShortDescription) BotMessageType() botmsg.Type
type TgChat ¶ added in v0.24.0
type TgChat struct {
// contains filtered or unexported fields
}
TgChat is wrapper for Telegram chat
func (TgChat) IsGroupChat ¶ added in v0.24.0
IsGroupChat indicates type of chat (group or private)
type TgChatInstance ¶ added in v0.19.0
type TgChatInstance struct {
record.WithID[string]
Data botsfwtgmodels.TgChatInstanceData
}
type TgChatInstanceDal ¶
type TgChatInstanceDal interface {
GetTelegramChatInstanceByID(c context.Context, id string) (tgChatInstance botsfwtgmodels.TgChatInstanceData, err error)
NewTelegramChatInstance(chatInstanceID string, chatID int64, preferredLanguage string) (tgChatInstance botsfwtgmodels.TgChatInstanceData)
SaveTelegramChatInstance(c context.Context, id string, tgChatInstance botsfwtgmodels.TgChatInstanceData) (err error)
}
TgChatInstanceDal is Data Access Layer for telegram chat instance Data
type TgWebhookInlineQuery ¶
type TgWebhookInlineQuery struct {
// contains filtered or unexported fields
}
TgWebhookInlineQuery is wrapper
func (TgWebhookInlineQuery) BotChatID ¶
func (iq TgWebhookInlineQuery) BotChatID() (string, error)
BotChatID returns bot chat ID
func (TgWebhookInlineQuery) GetFrom ¶
func (iq TgWebhookInlineQuery) GetFrom() botinput.Sender
GetFrom returns recipient
func (TgWebhookInlineQuery) GetInlineQueryID ¶
func (iq TgWebhookInlineQuery) GetInlineQueryID() string
GetInlineQueryID return inline query ID
func (TgWebhookInlineQuery) GetOffset ¶
func (iq TgWebhookInlineQuery) GetOffset() string
GetOffset returns offset
func (TgWebhookInlineQuery) GetQuery ¶
func (iq TgWebhookInlineQuery) GetQuery() string
GetQuery returns query string
func (TgWebhookInlineQuery) GetRecipient ¶
func (TgWebhookInlineQuery) LogRequest ¶
func (whi TgWebhookInlineQuery) LogRequest()
func (TgWebhookInlineQuery) MessageIntID ¶ added in v0.23.0
func (whi TgWebhookInlineQuery) MessageIntID() int
func (TgWebhookInlineQuery) MessageStringID ¶ added in v0.23.0
func (whi TgWebhookInlineQuery) MessageStringID() string
func (TgWebhookInlineQuery) TelegramChatID ¶
func (whi TgWebhookInlineQuery) TelegramChatID() int64
type TgWebhookInput ¶
TgWebhookInput is a wrapper of telegram update struct to bots framework interface
type WebhookCallbackQuery ¶ added in v0.19.0
type WebhookCallbackQuery interface {
botinput.CallbackQuery
GetInlineMessageID() string // Telegram only?
GetChatInstanceID() string // Telegram only?
}
Source Files
¶
- bot_messages.go
- bot_records_fields_setter.go
- bot_records_maker.go
- chat_instance_dal.go
- dal.go
- dalgo_stores.go
- get_message_uid.go
- input.go
- input_callback_query.go
- input_chat_left_members.go
- input_chat_new_members.go
- input_contact_message.go
- input_inline_result.go
- input_inlinequery.go
- input_message.go
- input_msg_audio.go
- input_msg_location.go
- input_msg_photo.go
- input_msg_sticker.go
- input_msg_text.go
- input_msg_users_shared.go
- input_msg_voice.go
- input_precheckoutquery.go
- input_refunded_payment.go
- input_successful_payment.go
- json.go
- message_type.go
- message_uid.go
- order_info.go
- photo_size.go
- platform.go
- settings.go
- tg_chat.go
- tg_responder.go
- tg_webhook_handler.go
- webhook_context_tg.go
- webhook_entry.go
- webhook_sender.go