Documentation
¶
Index ¶
- Constants
- func IsNumber(s string) bool
- func LimitStringLen(str string, maxLength int) string
- type AudioData
- type BackLinkStatsFeature
- type BuildMessageCallback
- type CheckPaymentStatus
- type CreateInvoicePayload
- type CreateInvoiceResponse
- type CustomCommandsFeature
- type EventMessage
- type FileData
- type FindInvoiceCallback
- type Funnel
- func (f *Funnel) EnableBackLinkStatsFeature(feature BackLinkStatsFeature) error
- func (f *Funnel) EnableCustomCommandsFeature(feature CustomCommandsFeature)
- func (f *Funnel) EnablePaymentsFeature(feature PaymentsFeature) error
- func (f *Funnel) EnableUTMTagsFeauture(feature UTMTagsFeature)
- func (f *Funnel) EnableUserInputFeature(feature UserInputFeature) error
- func (f *Funnel) EnableUsersFeature(feature UsersFeature)
- func (f *Funnel) GetEventQueryHandler(eventMessageID string) (*QueryHandler, error)
- func (f *Funnel) Run() error
- func (f *Funnel) SetupOnWebAppLaunchCallback(cb func(ctx tb.Context) error)
- type FunnelData
- type FunnelEvent
- type FunnelScript
- type GetInvoiceByIDCallback
- type GetUTMTagsCallback
- type HandleCommandCallback
- type ImageData
- type InvoiceData
- type InvoiceFullData
- type InvoiceImage
- type MessageButton
- type MessageType
- type OnBackLinkClick
- type OnConversionCallback
- type OnEventCallback
- type ParseFormat
- type PaymentData
- type PaymentEventLocker
- type PaymentNotify
- type PaymentStatus
- type PaymentSystemType
- type PaymentsFeature
- type QueryHandler
- type Resource
- type ResourcesCache
- func (r *ResourcesCache) Actualize(localFilePath string, fileData telebot.File)
- func (r *ResourcesCache) Get(localFilePath string) telebot.File
- func (r *ResourcesCache) IsNeedUpdate(localFilePath string, fileData telebot.File) bool
- func (r *ResourcesCache) Update(localFilePath string, fileData telebot.File) error
- type SaveInvoiceCB
- type SetInvoiceUniqueIDCB
- type SubscriptionEventLocker
- type UTMTags
- type UTMTagsFeature
- type UpdatePaymentStatusByIDCB
- type UpdatePaymentStatusCB
- type UserInputFeature
- type UserPayload
- type UsersFeature
- type VideoData
Constants ¶
View Source
const ( PaymentStatusCreated = "created" PaymentStatusSuccess = "success" PaymentStatusNotExists = "empty" PaymentSystemTypeTelegram = "telegram" PaymentSystemTypeLink = "link" )
Variables ¶
This section is empty.
Functions ¶
func IsNumber ¶ added in v1.11.11
IsNumber проверяет, является ли строка числом (целым или дробным).
func LimitStringLen ¶ added in v1.11.10
Types ¶
type BackLinkStatsFeature ¶ added in v1.14.27
type BackLinkStatsFeature struct {
OnClick OnBackLinkClick
}
type BuildMessageCallback ¶ added in v1.3.0
type BuildMessageCallback func(telegramUserID int64) interface{}
type CheckPaymentStatus ¶ added in v1.14.7
type CheckPaymentStatus func( telegramUserID int64, eventID string, ) (PaymentStatus, error)
type CreateInvoicePayload ¶ added in v1.14.7
type CreateInvoicePayload struct {
Payload InvoiceData
Payment PaymentData
Token string
FilesRoot string
}
type CreateInvoiceResponse ¶ added in v1.14.17
type CustomCommandsFeature ¶ added in v1.12.8
type CustomCommandsFeature struct {
Callback HandleCommandCallback
}
type EventMessage ¶
type EventMessage struct {
// main data
Text string `json:"text"`
// instead of main data
Callback BuildMessageCallback `json:"-"` // use it to redefine message
// additional events
OnEvent OnEventCallback `json:"-"`
// optional
Image string `json:"image"` // local filename or URL
ImageData ImageData `json:"imageData"`
File FileData `json:"file"`
Audio AudioData `json:"audio"`
Video VideoData `json:"video"`
Buttons []MessageButton `json:"buttons"`
Format ParseFormat `json:"format"`
ButtonsIsColumns bool `json:"buttonsIsColumns"`
ButtonsSplit int `json:"buttonsSplit"`
Conversion string `json:"conversion"` // optional
Conversions []string `json:"conversions"` // optional
OnConversion OnConversionCallback `json:"-"`
PinThisMessage bool `json:"pin"`
DisablePreview bool `json:"disablePreview"`
}
EventMessage - funnel event message data
type FindInvoiceCallback ¶ added in v1.14.25
type FindInvoiceCallback func( telegramUserID int64, eventID string, status PaymentStatus, ) (InvoiceFullData, error)
when invoice not found, func should return empty struct
type Funnel ¶
type Funnel struct {
// public
Data FunnelData
Script FunnelScript
OnWebAppCallback func(ctx tb.Context) error
// contains filtered or unexported fields
}
Funnel - telegram bot funnel
func NewFunnel ¶
func NewFunnel(data FunnelData, script FunnelScript) *Funnel
NewFunnel - funnel constructor
func (*Funnel) EnableBackLinkStatsFeature ¶ added in v1.14.27
func (f *Funnel) EnableBackLinkStatsFeature(feature BackLinkStatsFeature) error
func (*Funnel) EnableCustomCommandsFeature ¶ added in v1.12.8
func (f *Funnel) EnableCustomCommandsFeature(feature CustomCommandsFeature)
func (*Funnel) EnablePaymentsFeature ¶ added in v1.14.7
func (f *Funnel) EnablePaymentsFeature(feature PaymentsFeature) error
func (*Funnel) EnableUTMTagsFeauture ¶ added in v1.9.7
func (f *Funnel) EnableUTMTagsFeauture(feature UTMTagsFeature)
func (*Funnel) EnableUserInputFeature ¶ added in v1.12.2
func (f *Funnel) EnableUserInputFeature(feature UserInputFeature) error
func (*Funnel) EnableUsersFeature ¶ added in v1.0.9
func (f *Funnel) EnableUsersFeature(feature UsersFeature)
EnableUsersFeature !
func (*Funnel) GetEventQueryHandler ¶ added in v1.6.0
func (f *Funnel) GetEventQueryHandler( eventMessageID string, ) (*QueryHandler, error)
type FunnelData ¶
type FunnelData struct {
Token string `json:"token"`
ImageRoot string `json:"imageRoot"`
ResourcesCachePath string `json:"cachePath"`
}
FunnelData - data container for Funnel struct
type FunnelEvent ¶
type FunnelEvent struct {
Message EventMessage `json:"message"`
Subscription SubscriptionEventLocker `json:"locker"`
Payment PaymentEventLocker `json:"paymentLocker"`
}
FunnelEvent - user interaction event
type FunnelScript ¶
type FunnelScript map[string]FunnelEvent // message ID -> event
FunnelScript - funnel scenario
type GetInvoiceByIDCallback ¶ added in v1.14.23
type GetInvoiceByIDCallback func(id uint64) (InvoiceData, error)
type GetUTMTagsCallback ¶ added in v1.9.7
type HandleCommandCallback ¶ added in v1.12.8
type InvoiceData ¶ added in v1.14.7
type InvoiceData struct {
UserTelegramID int64 `json:"tid"`
ForEventID string `json:"eventID"`
Amount float64 `json:"amount"`
}
func (InvoiceData) IsSet ¶ added in v1.14.25
func (i InvoiceData) IsSet() bool
type InvoiceFullData ¶ added in v1.14.25
type InvoiceFullData struct {
InvoiceID uint64 // from db
InvoiceUniqueID string // from payment system
Payload InvoiceData // payload
}
func (InvoiceFullData) IsSet ¶ added in v1.14.25
func (i InvoiceFullData) IsSet() bool
type InvoiceImage ¶ added in v1.14.15
type MessageButton ¶
type MessageButton struct {
Text string `json:"text"`
NextMessageID string `json:"nextID"` // optional for URL-buttons
URL string `json:"url"` // optional. only for URL-buttons
UseUTMTags bool `json:"useUtmTags"` // optional
SkipRenderInGraph bool `json:"skipRender"` // optional
}
MessageButton - funnel event message button
type MessageType ¶ added in v1.7.5
type MessageType string
const ( MessageTypeText MessageType = "text" MessageTypePhoto MessageType = "photo" MessageTypeDocument MessageType = "document" MessageTypeVideo MessageType = "video" MessageTypeAudio MessageType = "audio" )
type OnBackLinkClick ¶ added in v1.14.27
type OnConversionCallback ¶ added in v1.6.2
type OnConversionCallback func( telegramUserID int64, conversionTag string, payload UserPayload, ) error
type OnEventCallback ¶ added in v1.3.0
type ParseFormat ¶ added in v1.6.3
type ParseFormat string
const ( ParseFormatMarkdown ParseFormat = ParseFormat(tb.ModeMarkdown) ParseFormatHTML ParseFormat = ParseFormat(tb.ModeHTML) )
type PaymentData ¶ added in v1.14.7
type PaymentData struct {
// required
Amount float64 `json:"amount"`
Title string `json:"title"`
Description string `json:"description"`
Label string `json:"label"`
// optional
ReusablePayment bool `json:"reusable"`
CurrencyCode string `json:"currencyCode"`
Image InvoiceImage `json:"image"`
BtnLabel string `json:"btnLabel"`
}
type PaymentEventLocker ¶ added in v1.14.7
type PaymentEventLocker struct {
Enabled bool `json:"enabled"`
Data PaymentData `json:"data"`
}
type PaymentNotify ¶ added in v1.14.18
type PaymentStatus ¶ added in v1.14.7
type PaymentStatus string
type PaymentSystemType ¶ added in v1.14.22
type PaymentSystemType string
type PaymentsFeature ¶ added in v1.14.7
type PaymentsFeature struct {
// public
Token string
CheckoutFailedEventID string
CheckoutSuccessEventID string
CheckoutWaitEventID string
CheckPaymentCallback CheckPaymentStatus
GetInvoiceByID GetInvoiceByIDCallback
UpdatePaymentStatus UpdatePaymentStatusCB
UpdatePaymentStatusByID UpdatePaymentStatusByIDCB
SavePayment SaveInvoiceCB
FindInvoice FindInvoiceCallback
SetInvoiceUniqueID SetInvoiceUniqueIDCB
PaymentType PaymentSystemType
Notify PaymentNotify
BotUserName string // for yookassa link payments
AccountID string // for yookassa link payments
SecretKey string // for yookassa link payments
// contains filtered or unexported fields
}
func (PaymentsFeature) IsNotifyEnabled ¶ added in v1.14.19
func (p PaymentsFeature) IsNotifyEnabled() bool
type QueryHandler ¶ added in v1.6.0
type QueryHandler struct {
Script FunnelScript
EventMessageID string
EventData FunnelEvent
Menu *tb.ReplyMarkup
ParseMode tb.ParseMode
Bot *tb.Bot
FilesRoot string // inherit from Funnel
Features *funnelFeatures
// contains filtered or unexported fields
}
telegram user query handler
func (*QueryHandler) ActualizeCache ¶ added in v1.14.0
func (q *QueryHandler) ActualizeCache(st fileState, response *tb.Message)
func (*QueryHandler) CustomHandle ¶ added in v1.6.0
func (q *QueryHandler) CustomHandle(telegramUserID int64) error
type ResourcesCache ¶ added in v1.14.0
type ResourcesCache struct {
// contains filtered or unexported fields
}
func NewResourceCache ¶ added in v1.14.0
func NewResourceCache(cachePath string, pathRoot string) *ResourcesCache
func (*ResourcesCache) Actualize ¶ added in v1.14.0
func (r *ResourcesCache) Actualize( localFilePath string, fileData telebot.File, )
func (*ResourcesCache) Get ¶ added in v1.14.0
func (r *ResourcesCache) Get(localFilePath string) telebot.File
func (*ResourcesCache) IsNeedUpdate ¶ added in v1.14.0
func (r *ResourcesCache) IsNeedUpdate( localFilePath string, fileData telebot.File, ) bool
type SaveInvoiceCB ¶ added in v1.14.23
type SaveInvoiceCB func(InvoiceData) (uint64, error)
type SetInvoiceUniqueIDCB ¶ added in v1.14.25
type SubscriptionEventLocker ¶ added in v1.14.7
type UTMTagsFeature ¶ added in v1.9.7
type UTMTagsFeature struct {
GetUserUTMTags GetUTMTagsCallback
}
type UpdatePaymentStatusByIDCB ¶ added in v1.14.24
type UpdatePaymentStatusByIDCB func( id uint64, newStatus PaymentStatus, ) error
type UpdatePaymentStatusCB ¶ added in v1.14.9
type UpdatePaymentStatusCB func( telegramUserID int64, eventID string, newStatus PaymentStatus, ) error
type UserInputFeature ¶ added in v1.12.2
type UserPayload ¶ added in v1.11.10
type UserPayload struct {
UTMSource string `json:"s"`
UTMCampaign string `json:"c"`
UTMContent string `json:"t"`
BackLinkEventID string `json:"b"`
Yclid string `json:"y"`
InvoiceID string `json:"i"`
}
func FilterUserPayload ¶ added in v1.11.12
func FilterUserPayload( payloadRaw string, ) (UserPayload, error)
payload format: source_campaign_yclid example: dzen_start or: dzen_start_100
func (UserPayload) IsEmpty ¶ added in v1.12.1
func (p UserPayload) IsEmpty() bool
func (UserPayload) IsOnlyBacklinkAvailable ¶ added in v1.14.27
func (p UserPayload) IsOnlyBacklinkAvailable() bool
func (UserPayload) String ¶ added in v1.12.1
func (p UserPayload) String() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.