processor

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotAddedToChat

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

func NewBotAddedToChat

func NewBotAddedToChat(proccessor Processor, bot *tgbotapi.BotAPI) *BotAddedToChat

func (*BotAddedToChat) Process

func (a *BotAddedToChat) Process(update tgbotapi.Update, ctx context.Context) bool

type BotRemovedFromChat

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

func NewBotRemovedFromChat

func NewBotRemovedFromChat(proccessor Processor, bot *tgbotapi.BotAPI) *BotRemovedFromChat

func (*BotRemovedFromChat) Process

func (a *BotRemovedFromChat) Process(update tgbotapi.Update, ctx context.Context) bool

type CallbackQuery

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

func (CallbackQuery) Process

func (c CallbackQuery) Process(update tgbotapi.Update, ctx context.Context) bool

type Chain

type Chain []Processor

func (Chain) Process

func (c Chain) Process(update tgbotapi.Update, ctx context.Context) bool

type ChatType added in v0.0.2

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

func NewAnyGroupChat added in v0.0.2

func NewAnyGroupChat(processor Processor) *ChatType

func NewChannelChat added in v0.0.2

func NewChannelChat(processor Processor) *ChatType

func NewPrivateChat added in v0.0.2

func NewPrivateChat(processor Processor) *ChatType

func (*ChatType) Process added in v0.0.2

func (p *ChatType) Process(update tgbotapi.Update, ctx context.Context) bool

type CommandWordResolver

type CommandWordResolver interface {
	Resolve(word string, ctx context.Context) ResolveResult
}

type CommandWordResolverExactWord

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

func (CommandWordResolverExactWord) Resolve

type Composite added in v0.0.2

type Composite []Processor

func (Composite) Process added in v0.0.2

func (c Composite) Process(update tgbotapi.Update, ctx context.Context) bool

type EasyCommandSplit

type EasyCommandSplit struct{}

func (EasyCommandSplit) Split

func (e EasyCommandSplit) Split(update tgbotapi.Update, ctx context.Context) (command string, other string)

func (EasyCommandSplit) SplitByText

func (e EasyCommandSplit) SplitByText(text string) (string, string)

type EmptyPredefinedProcessor

type EmptyPredefinedProcessor struct {
}

func (EmptyPredefinedProcessor) Process

type Factory

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

func NewFactory

func NewFactory(api *tgbotapi.BotAPI, storage LastMessageStorage) *Factory

func (Factory) AnyGroup added in v0.0.2

func (f Factory) AnyGroup(processor Processor) Processor

func (Factory) Api

func (f Factory) Api() *tgbotapi.BotAPI

func (Factory) CallbackQuery

func (f Factory) CallbackQuery(processor Processor) CallbackQuery

func (Factory) Chain

func (f Factory) Chain(processors ...Processor) Chain

func (Factory) Composite added in v0.0.2

func (f Factory) Composite(processors ...Processor) Composite

func (Factory) EasyApi

func (f Factory) EasyApi() *easy.EasyApi

func (*Factory) EmptyPredefined

func (f *Factory) EmptyPredefined() Processor

func (Factory) LastMessageProcessor

func (f Factory) LastMessageProcessor(processor Processor) Processor

func (Factory) LastMessageStorage

func (f Factory) LastMessageStorage() LastMessageStorage

func (Factory) Message

func (f Factory) Message(processor Processor) WithMessage

func (Factory) OneWordCommand

func (f Factory) OneWordCommand(resolver CommandWordResolver, processor Processor) OneWordCommand

func (*Factory) PredefinedReply

func (f *Factory) PredefinedReply(replyMessage string) Processor

func (Factory) Private

func (f Factory) Private(processor Processor) Processor

func (Factory) SimpleCommand

func (f Factory) SimpleCommand(command string, processor Processor) OneWordCommand

func (Factory) SimpleCommandMap

func (f Factory) SimpleCommandMap(mapping map[string]Processor) SimpleCommandMap

func (*Factory) WithFileMimeType

func (f *Factory) WithFileMimeType(mimeTpe string, processor Processor) Processor

type LastMessageProcessor

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

func (LastMessageProcessor) Process

func (p LastMessageProcessor) Process(update tgbotapi.Update, ctx context.Context) bool

type LastMessageRepo

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

func NewLastMessageRepo

func NewLastMessageRepo() *LastMessageRepo

func (LastMessageRepo) GetByUpdate

func (r LastMessageRepo) GetByUpdate(update *tgbotapi.Update) string

func (LastMessageRepo) GetByUser

func (r LastMessageRepo) GetByUser(user *tgbotapi.User) string

func (LastMessageRepo) Store

func (r LastMessageRepo) Store(user *tgbotapi.User, text string)

func (LastMessageRepo) StoreByUpdate

func (r LastMessageRepo) StoreByUpdate(update *tgbotapi.Update, text string)

type LastMessageStorage

type LastMessageStorage interface {
	GetByUser(user *tgbotapi.User) string
	GetByUpdate(update *tgbotapi.Update) string
	Store(user *tgbotapi.User, text string)
	StoreByUpdate(user *tgbotapi.Update, text string)
}

type OneWordCommand

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

func (OneWordCommand) Process

func (c OneWordCommand) Process(update tgbotapi.Update, ctx context.Context) bool

type PredefinedReplyProcessor

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

func NewPredefinedReplyProcessor

func NewPredefinedReplyProcessor(easyApi *easy.EasyApi, replyMessage string) *PredefinedReplyProcessor

func (*PredefinedReplyProcessor) Process

func (p *PredefinedReplyProcessor) Process(update tgbotapi.Update, ctx context.Context) bool

type Private

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

deprecated

func (Private) Process

func (p Private) Process(update tgbotapi.Update, ctx context.Context) bool

type Processor

type Processor interface {
	Process(update tgbotapi.Update, ctx context.Context) bool
}

type ResolveResult

type ResolveResult struct {
	Ok         bool
	ForbidNext bool
	Context    context.Context
}

func NewResolverResultNok

func NewResolverResultNok() ResolveResult

func NewResolverResultOk

func NewResolverResultOk(ctx context.Context) ResolveResult

func NewResolverResultStop

func NewResolverResultStop() ResolveResult

type SimpleCommand

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

func (SimpleCommand) Process

func (c SimpleCommand) Process(update tgbotapi.Update, ctx context.Context) bool

type SimpleCommandCtx

type SimpleCommandCtx struct {
	context.Context
}

func (SimpleCommandCtx) Command

func (s SimpleCommandCtx) Command() string

type SimpleCommandMap

type SimpleCommandMap map[string]Processor

func (SimpleCommandMap) Process

func (p SimpleCommandMap) Process(update tgbotapi.Update, ctx context.Context) bool

type WithFile

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

func (*WithFile) Process

func (w *WithFile) Process(update tgbotapi.Update, ctx context.Context) bool

type WithFileMimeTypes

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

func (*WithFileMimeTypes) Process

func (w *WithFileMimeTypes) Process(update tgbotapi.Update, ctx context.Context) bool

type WithMessage

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

func (WithMessage) Process

func (p WithMessage) Process(update tgbotapi.Update, ctx context.Context) bool

Jump to

Keyboard shortcuts

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