app

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Public = CommandScope{/* contains filtered or unexported fields */}

Functions

func AddDefaultStart added in v0.9.33

func AddDefaultStart(commands Commands, registry telegram.CommandRegistry, version string)

Types

type CommandScope

type CommandScope struct {
	ChatIDs, UserIDs map[telegram.ID]bool
	// contains filtered or unexported fields
}

func (CommandScope) Labels added in v0.9.32

func (s CommandScope) Labels() metrics.Labels

func (CommandScope) Transform added in v0.9.32

func (s CommandScope) Transform(body func(scope telegram.BotCommandScope))

func (CommandScope) Wrap

type Commands

type Commands map[telegram.BotCommandScope]map[string]string

func (Commands) Add

func (c Commands) Add(scope telegram.BotCommandScope, command, description string)

func (Commands) AddAll added in v0.9.32

func (c Commands) AddAll(scope telegram.BotCommandScope, commands ...string)

func (Commands) Set

func (c Commands) Set(ctx context.Context, client telegram.Client) error

type Extension

type Extension interface {
	ID() string
	Apply(ctx context.Context, app Interface) (interface{}, error)
}

type Instance

type Instance struct {
	*app.Base
	// contains filtered or unexported fields
}

func Create

func Create(version string, clock flu.Clock) *Instance

func (*Instance) ApplyExtensions

func (app *Instance) ApplyExtensions(extensions ...Extension)

func (*Instance) Configure added in v0.10.0

func (app *Instance) Configure(configurer app.Configurer) error

func (*Instance) GetBot

func (app *Instance) GetBot(ctx context.Context) (*telegram.Bot, error)

func (*Instance) Run

func (app *Instance) Run(ctx context.Context) error

type Interface

type Interface interface {
	flu.Clock
	GetConfig() app.Config
	GetMetricsRegistry(ctx context.Context) (metrics.Registry, error)
	GetDatabase(driver, conn string) (*gorm.DB, error)
	GetBot(ctx context.Context) (*telegram.Bot, error)
	Manage(service io.Closer)
}

type Scoped

type Scoped interface {
	CommandScope() CommandScope
}

Jump to

Keyboard shortcuts

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