tgrouter

package
v0.0.0-...-f69e0f1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	UrlPath      string
	ValueStr     string
	ValueInt64   int64
	ValueFloat64 float64
}

func (*Button) Decode

func (b *Button) Decode(str string) error

func (Button) Encode

func (b Button) Encode() string

type Router

type Router struct {
	Bot *tgbotapi.BotAPI

	Button *buttonRouter //频道消息
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(bot *tgbotapi.BotAPI, debug bool) *Router

NewRouter 新建一个路由分发

func (*Router) RunDefault

func (r *Router) RunDefault(ctx *context.Context)

RunDefault 开始运行机器人,执行路由分发

func (*Router) SetChannel

func (r *Router) SetChannel(fx func(*tgbotapi.BotAPI, *tgbotapi.Message, *context.Context))

SetChannel 设置频道消息响应函数

func (*Router) SetGroup

func (r *Router) SetGroup(fx func(*tgbotapi.BotAPI, *tgbotapi.Message, *context.Context))

SetGroup 设置普通群组消息响应函数

func (*Router) SetPrivate

func (r *Router) SetPrivate(fx func(*tgbotapi.BotAPI, *tgbotapi.Message, *context.Context))

SetPrivate 设置私信消息,响应函数

func (*Router) SetSupergroup

func (r *Router) SetSupergroup(fx func(*tgbotapi.BotAPI, *tgbotapi.Message, *context.Context))

SetSupergroup 设置超级群组消息,响应函数。

Jump to

Keyboard shortcuts

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