Documentation
¶
Overview ¶
Package telegram 实现 Telegram Bot API 适配器。 协议要点:
- 鉴权用静态 Bot Token(从 @BotFather 获取,形如 123456:ABC-DEF),无需动态刷新
- 接收消息用 getUpdates long polling(offset + timeout),比 WebSocket 简单且无需公网回调
- 发送消息/typing/审批按钮均走 REST(sendMessage / sendChatAction / answerCallbackQuery)
- 审批按钮复用 bot.InlineKeyboard,在 Send 里翻译成 Telegram 的 reply_markup.inline_keyboard
参考 internal/bot/qq 的三段式结构(adapter 薄壳 + gateway 收发),删去 WebSocket 握手/心跳。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendText ¶
func SendText(ctx context.Context, cfg config.TelegramBotConfig, chatID, text string) (bot.SendResult, error)
SendText 是桌面端 TestBotConnection / 主动推送用的便捷函数(照抄 feishu/weixin 的同名函数形态)。 它不依赖 adapter 实例(独立读 token),所以 TestBotConnection 不必先 Start adapter。
func VerifyToken ¶
VerifyToken 调用 getMe 校验 token 有效性,返回 bot 的 username。 供桌面 install 流在保存连接前校验用户粘贴的 token。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.