tgfun

package module
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

README

tgfun

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildMessageCallback added in v1.3.0

type BuildMessageCallback func(tb.Context) interface{}

type EventMessage

type EventMessage struct {
	// main data
	Text  string `json:"text"`
	Image string `json:"image"` // local filename or URL. optional

	// instead of main data
	Callback BuildMessageCallback `json:"-"` // use it to redefine message

	// additional events
	OnEvent OnEventCallback `json:"-"`

	// optional
	Buttons          []MessageButton `json:"buttons"` // optional
	ButtonsIsColumns bool            `json:"buttonsIsColumns"`
	IsCTA            bool            `json:"isCTA"`
	OnCTA            OnEventCallback `json:"-"`
}

EventMessage - funnel event message data

type Funnel

type Funnel struct {
	// public
	Data   FunnelData
	Script FunnelScript
	// contains filtered or unexported fields
}

Funnel - telegram bot funnel

func NewFunnel

func NewFunnel(data FunnelData, script FunnelScript) *Funnel

NewFunnel - funnel constructor

func (*Funnel) EnableUsersFeature added in v1.0.9

func (f *Funnel) EnableUsersFeature(feature UsersFeature)

EnableUsersFeature !

func (*Funnel) Run

func (f *Funnel) Run() error

Run funnel. This is a non-blocking operation

type FunnelData

type FunnelData struct {
	Token     string `json:"token"`
	ImageRoot string `json:"imageRoot"`
}

FunnelData - data container for Funnel struct

type FunnelEvent

type FunnelEvent struct {
	Message EventMessage `json:"message"`
}

FunnelEvent - user interaction event

type FunnelScript

type FunnelScript map[string]FunnelEvent // message ID -> event

FunnelScript - funnel scenario

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
}

MessageButton - funnel event message button

type OnEventCallback added in v1.3.0

type OnEventCallback func(tb.Context) error

type UsersFeature added in v1.0.9

type UsersFeature struct {
	// required
	DBConn    *sql.DB
	TableName string

	// optional
	AdminChatID int64
}

UsersFeature - feature to enable users db

Directories

Path Synopsis
lib module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL