bot

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChatTyping = "typing"
)

Constant values for ChatActions.

Variables

View Source
var (
	WebPagePreview = false
)

Functions

This section is empty.

Types

type Bot

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

Bot is structure representation of Bot instance.

func New

func New(store store.Store) *Bot

New creates new instance of the Bot. Idiomatically, there is only one "Bot" instance per application.

func (*Bot) Handle

func (bot *Bot) Handle(key string, handler Handler)

Handle registers handler by key.

func (*Bot) HandleFunc

func (bot *Bot) HandleFunc(key string, handler func(*Event))

HandleFunc registers handler function by key.

func (*Bot) HandleFuncRegexp

func (bot *Bot) HandleFuncRegexp(expr string, handler func(*Event))

HandleFuncRegexp registers handler function by regular expression.

func (*Bot) HandlePhoto added in v0.0.17

func (bot *Bot) HandlePhoto(handler func(*Event))

func (*Bot) HandleRegexp

func (bot *Bot) HandleRegexp(regexp *regexp.Regexp, handler Handler)

HandleRegexp registers handler by regular expression.

func (*Bot) Listen

func (bot *Bot) Listen(host, port string) error

Listen for telegram updates.

type Event

type Event struct {
	API     *tgbotapi.BotAPI
	Message *tgbotapi.Message
}

Event ...

func (*Event) Send

func (event *Event) Send(text string) error

Send ...

func (*Event) SendHTML

func (event *Event) SendHTML(text string) error

SendHTML sends message to the chat with text formatted as HTML.

func (*Event) SetStatus

func (event *Event) SetStatus(status string) error

SetStatus ...

type Handler

type Handler interface {
	Handle(msg *Event)
}

Handler ...

type HandlerFunc

type HandlerFunc func(msg *Event)

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(msg *Event)

type MuxEntry

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

Jump to

Keyboard shortcuts

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