bot

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	TgBot               *tgbotapi.BotAPI
	Proxy               string
	Token               string
	Router              *BotRouter
	CallbackQueryRouter *BotRouter
	ExitChan            chan interface{}
	Logger              *ezlog.EzLogger
}

func NewBot

func NewBot(token string, proxy string) (*Bot, error)

func (*Bot) Dispatch

func (bot *Bot) Dispatch(update *tgbotapi.Update)

func (*Bot) Loop

func (bot *Bot) Loop()

type BotRouter

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

func NewBotRouter

func NewBotRouter() *BotRouter

func (*BotRouter) AddHandle

func (r *BotRouter) AddHandle(url string, handleFunc HandleFunc)

func (*BotRouter) DoHandle

func (r *BotRouter) DoHandle(url string, update *tgbotapi.Update)

type HandleFunc

type HandleFunc func(*tgbotapi.Update)

type Router

type Router interface {
	DoHandle(url string, update *tgbotapi.Update)
	AddHandle(url string, handleFunc HandleFunc)
}

Jump to

Keyboard shortcuts

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