bot

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

func New

func New(botAPI *telegram.BotAPI, state types.StateProvider,
	context types.ContextProvider, assets types.Assets,
	paymentProviders types.PaymentProviders, secrets types.Secrets,
	apiAddr string, log zerolog.Logger,
) *Bot

func NewFromSpec

func NewFromSpec(s *spec.Bot) (*Bot, error)

func (*Bot) ApiHandler

func (b *Bot) ApiHandler(id string, h api.Handler)

func (*Bot) Handle

func (b *Bot) Handle(filter types.EventFilter, h types.Handler)

func (*Bot) HandleUpdate

func (b *Bot) HandleUpdate(ctx context.Context, upd *telegram.Update)

HandleUpdate handles telegram update and log error if any. Deprecated: use HandleUpdateErr instead, in next major release HandlerUpdateErr will be renamed to HandleUpdate.

func (*Bot) HandleUpdateErr added in v1.4.0

func (b *Bot) HandleUpdateErr(ctx context.Context, upd *telegram.Update) error

HandleUpdateErr handles telegram update and returns error if any.

func (*Bot) HandleWithData added in v1.6.0

func (b *Bot) HandleWithData(filter types.EventFilter, h types.Handler, dl types.DataLoader)

func (*Bot) HandlerAPI added in v1.7.0

func (b *Bot) HandlerAPI(cfg api.Config) *api.Service

func (*Bot) SetupApiHandlersFromSpec

func (b *Bot) SetupApiHandlersFromSpec(src []*spec.ApiHandler) error

func (*Bot) SetupHandlersFromSpec

func (b *Bot) SetupHandlersFromSpec(src []*spec.Handler) error

func (*Bot) Start

func (b *Bot) Start() error

func (*Bot) Stop

func (b *Bot) Stop() error

Jump to

Keyboard shortcuts

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