bot

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(ctx context.Context, b *bot.Bot, update *models.Update) bool

func OnPhoto

func OnPhoto(ctx context.Context, b *bot.Bot, update *models.Update)

func OnText

func OnText(ctx context.Context, b *bot.Bot, update *models.Update)

Types

type BotApp

type BotApp struct {
	Bot    *bot.Bot
	Config *config.AppConfig
	Client *http.Client
}

BotApp 是整个机器人的启动器和控制器

func NewBotApp

func NewBotApp(cfg *config.AppConfig) *BotApp

NewBotApp 初始化并返回应用实例

func (*BotApp) ConfigureWebhook

func (app *BotApp) ConfigureWebhook()

ConfigureWebhook 不再使用轮询阻塞,而是配置 Webhook。 这里仅仅是调用 Telegram API 设置 Webhook URL,真正的 HTTP 请求将由 web server 处理。

func (*BotApp) Handler

func (app *BotApp) Handler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*BotApp) RemoveWebhook

func (app *BotApp) RemoveWebhook()

RemoveWebhook 退出时自动去掉 Webhook

func (*BotApp) WebhookInfo

func (app *BotApp) WebhookInfo()

Jump to

Keyboard shortcuts

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