maxbot

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnMessageCreated        = "message_created"
	OnMessageCallback       = "message_callback"
	OnMessageEdited         = "message_edited"
	OnMessageRemoved        = "message_removed"
	OnBotAdded              = "bot_added"
	OnBotRemoved            = "bot_removed"
	OnUserAdded             = "user_added"
	OnUserRemoved           = "user_removed"
	OnBotStarted            = "bot_started"
	OnBotStopped            = "bot_stopped"
	OnDialogCleared         = "dialog_cleared"
	OnDialogRemoved         = "dialog_removed"
	OnDialogMuted           = "dialog_muted"
	OnDialogUnmuted         = "dialog_unmuted"
	OnChatTitleChangedEvent = "chat_title_changed"
	OnText                  = "text"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Info model.BotInfo
	// contains filtered or unexported fields
}

func NewApi

func NewApi(token string, opt ...Opt) (*Api, error)

func (*Api) Client

func (a *Api) Client() *maxbot.Api

func (*Api) Handle

func (a *Api) Handle(endpoint string, h HandlerFunc, m ...MiddlewareFunc)

func (*Api) HandleCallback

func (a *Api) HandleCallback(endpoint string, h HandlerFunc, m ...MiddlewareFunc)

func (*Api) OnError

func (a *Api) OnError(err error, c Context)

func (*Api) ProcessContext

func (a *Api) ProcessContext(c Context)

func (*Api) ProcessUpdate

func (a *Api) ProcessUpdate(_ context.Context, u model.Update)

func (*Api) Start

func (a *Api) Start()

func (*Api) Stop

func (a *Api) Stop()

func (*Api) Use

func (a *Api) Use(middleware ...MiddlewareFunc)

func (*Api) WebhookHandler

func (a *Api) WebhookHandler() http.HandlerFunc

type Context

type Context interface {
	Update() model.Update
	Send(text string, opts ...Option) error
	Edit(text string, opts ...Option) error
	Delete(opts ...Option) error
	Context() context.Context
}

func NewContext

func NewContext(ctx context.Context, b *maxbot.Api, u model.Update) Context

type Group

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

func (*Group) Handle

func (g *Group) Handle(endpoint string, h HandlerFunc, m ...MiddlewareFunc)

func (*Group) Use

func (g *Group) Use(middleware ...MiddlewareFunc)

type HandlerFunc

type HandlerFunc func(Context) error

type MiddlewareFunc

type MiddlewareFunc func(HandlerFunc) HandlerFunc

type Opt

type Opt func(cli *Api)

func WithBaseURL

func WithBaseURL(baseURL string) Opt

func WithErrorHandle

func WithErrorHandle(f func(error, Context)) Opt

func WithHTTPClient

func WithHTTPClient(cli maxbot.HttpClient) Opt

func WithPollingPause

func WithPollingPause(d time.Duration) Opt

func WithPollingTimeout

func WithPollingTimeout(d time.Duration) Opt

func WithWebhook

func WithWebhook(webhookUrl, secret string, types []string) Opt

type Option

type Option func(msg *maxbot.Message)

func WithKeyboard

func WithKeyboard(keyboard *model.Keyboard) Option

Directories

Path Synopsis
example
simple command

Jump to

Keyboard shortcuts

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