parser

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCallbackHandler

func AddCallbackHandler(data string, handlerFun func(*objs.Update))

func AddHandler

func AddHandler(patern string, handlerFunc func(*objs.Update), chatType ...string) error

func ParseSingleUpdate

func ParseSingleUpdate(up *objs.Update, uc *chan *objs.Update, cu *chan *objs.ChatUpdate, cfg *configs.BotConfigs)

ParseSingleUpdate processes the given update object.

func ParseUpdate

func ParseUpdate(body []byte, uc *chan *objs.Update, cu *chan *objs.ChatUpdate, cfg *configs.BotConfigs) (int, error)

ParseUpdate parses the received update and returns the last update offset.

Types

type HandlerTree

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

HandlerTree is a special binary tree for storing handlers. Right node hase a value that does not match the it's father regex and the left node matches it's father regex.

func (*HandlerTree) AddHandler

func (tr *HandlerTree) AddHandler(hdl *handler)

AddHandler adds a new handler to the tree.

func (*HandlerTree) GetHandler

func (tr *HandlerTree) GetHandler(msg *objs.Message) *handler

GetHandler gets the proper handler for the given text.

type TreeNode

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

TreeNode is a special tree element containing handlers.

Jump to

Keyboard shortcuts

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