handlers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChatID

func ChatID(upd *telegram.Update) types.ChatID

func NewCallbackFilterFromSpec

func NewCallbackFilterFromSpec(s *spec.CallbackTrigger) (types.EventFilter, error)

func NewContextFilter

func NewContextFilter(base types.EventFilter, cp types.ContextProvider, val string) types.EventFilter

func NewMessageFilterFromSpec

func NewMessageFilterFromSpec(s *spec.MessageTrigger) (types.EventFilter, error)

Types

type CallbackFilter

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

CallbackFilter check update callback data.

func (*CallbackFilter) Check

func (h *CallbackFilter) Check(ctx context.Context, update *telegram.Update) (bool, error)

type CallbackReply

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

func NewCallbackReply

func NewCallbackReply(text string, alert bool) *CallbackReply

func (*CallbackReply) Handle

func (h *CallbackReply) Handle(ctx context.Context, update *telegram.Update,
	bot *telegram.BotAPI) error

type ContextFilter

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

func (*ContextFilter) Check

func (h *ContextFilter) Check(ctx context.Context, update *telegram.Update) (bool, error)

type DeleteContextHandler

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

func NewContextDeleter

func NewContextDeleter(base types.Handler, cp types.ContextProvider, val string) *DeleteContextHandler

func (*DeleteContextHandler) Handle

type InlineButton

type InlineButton struct {
	Text     string
	URL      string
	Callback string
}

type MessageFilter

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

MessageFilter checks update by message criteria.

func (*MessageFilter) Check

func (h *MessageFilter) Check(ctx context.Context, update *telegram.Update) (bool, error)

type MessageModifier

type MessageModifier func(*telegram.MessageConfig)

func MessageWithInlinceKeyboard

func MessageWithInlinceKeyboard(keyboard [][]InlineButton) MessageModifier

func MessageWithKeyboard

func MessageWithKeyboard(keyboard [][]string) MessageModifier

func MessageWithParseMode

func MessageWithParseMode(mode string) MessageModifier

type MessageReplier

type MessageReplier func(ctx context.Context, chatID types.ChatID, bot *telegram.BotAPI) error

MessageReplier func reply to message in chat.

func NewMessageReplier

func NewMessageReplier(sp types.StateProvider, text string, modifiers ...MessageModifier) MessageReplier

type MessageReply

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

MessageReply handler processes telegram updates and reply message to them.

func NewMessageReply

func NewMessageReply(replier MessageReplier) *MessageReply

NewMessageReply from repliers funcs.

func (*MessageReply) Handle

func (h *MessageReply) Handle(ctx context.Context, update *telegram.Update,
	bot *telegram.BotAPI) error

type SetContextHandler

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

func NewContextSetter

func NewContextSetter(base types.Handler, cp types.ContextProvider, value string) *SetContextHandler

func (*SetContextHandler) Handle

func (h *SetContextHandler) Handle(ctx context.Context, upd *telegram.Update, api *telegram.BotAPI) error

type StateHandler

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

func NewStateHandlerFromSpec

func NewStateHandlerFromSpec(provider types.StateProvider, spec *spec.State) *StateHandler

func (*StateHandler) Handle

func (h *StateHandler) Handle(ctx context.Context, update *telegram.Update) error

type Webhook

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

func NewWebhook

func NewWebhook(url *url.URL, method string, body []byte) *Webhook

func (*Webhook) Handle

func (h *Webhook) Handle(ctx context.Context, _ *telegram.Update, _ *telegram.BotAPI) error

Jump to

Keyboard shortcuts

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