Documentation
¶
Index ¶
- Variables
- type Context
- type Dispatcher
- type GeneralDispatcher
- func (g *GeneralDispatcher) AddHandler(handler Handler) HandlerID
- func (g *GeneralDispatcher) AddHandlerToGroup(group int, handler Handler) HandlerID
- func (g *GeneralDispatcher) RemoveGroup(group int)
- func (g *GeneralDispatcher) RemoveHandler(id HandlerID) bool
- func (g *GeneralDispatcher) Run(bot *gottbot.Bot, updateChan chan *gottbot.Update)
- type Handler
- type HandlerID
- type Updater
- type UpdaterOpts
- type WebhookOpts
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { EffectiveUser *gottbot.User EffectiveMessage *gottbot.Message EffectiveQuery *gottbot.Callback EffectiveChatId int64 Data map[string]any *gottbot.Update }
Context contains the important data of the current update.
func NewContext ¶
type Dispatcher ¶
type GeneralDispatcher ¶
type GeneralDispatcher struct { ErrorHandler func(*gottbot.Bot, *gottbot.Update, error) // contains filtered or unexported fields }
GeneralDispatcher is the default dispatcher.
func NewDispatcher ¶
NewDispatcher creates a new general dispatcher.
func (*GeneralDispatcher) AddHandler ¶
func (g *GeneralDispatcher) AddHandler(handler Handler) HandlerID
AddHandler appends the provided handler to the handler group 0.
func (*GeneralDispatcher) AddHandlerToGroup ¶
func (g *GeneralDispatcher) AddHandlerToGroup(group int, handler Handler) HandlerID
AddHandlerToGroup appends the provided handler to the provided handler group.
func (*GeneralDispatcher) RemoveGroup ¶
func (g *GeneralDispatcher) RemoveGroup(group int)
RemoveGroup removes the whole handler group.
func (*GeneralDispatcher) RemoveHandler ¶
func (g *GeneralDispatcher) RemoveHandler(id HandlerID) bool
RemoveHandler removes the handler from any further service.
type Updater ¶
type Updater struct { Dispatcher Dispatcher // contains filtered or unexported fields }
Updater fetches the updates from bot api
Either by StartWebhook or by StartPolling
func (*Updater) StartPolling ¶
func (u *Updater) StartPolling(bot *gottbot.Bot, opts *gottbot.GetUpdatesOpts)
func (*Updater) StartWebhook ¶
func (u *Updater) StartWebhook(bot *gottbot.Bot, opts *WebhookOpts)
type UpdaterOpts ¶
type UpdaterOpts struct { Dispatcher Dispatcher ErrorHandler func(*gottbot.Bot, *gottbot.Update, error) }
Optional fields for the NewUpdater
Click to show internal directories.
Click to hide internal directories.