Documentation
¶
Overview ¶
Package telegram provides Telegram Bot API helpers for sending messages and managing interactions.
It wraps the go-telegram/bot library to send text messages, voice (OGG) messages, and emoji reactions. It also provides rendering helpers for interactive question pages with inline keyboards, used by the daemon to surface AskUserQuestion prompts from agent sessions to the human operator over Telegram.
Plane: shared
Index ¶
- func EditQuestionMessage(botToken string, chatID int64, messageID int, text string, ...) error
- func ParseChatID(s string) (int64, error)
- func RenderCustomInputPrompt(p QuestionPage) (string, *models.InlineKeyboardMarkup)
- func RenderQuestionPage(p QuestionPage) (string, *models.InlineKeyboardMarkup)
- func RenderSubmittedSummary(agentName string, questions []string, answers []string) string
- func SendMessage(botToken, chatID, text string) error
- func SendQuestionMessage(botToken string, chatID int64, text string, ...) (int, error)
- func SendVoice(botToken string, chatID int64, oggData []byte) error
- func SetReaction(botToken string, chatID int64, messageID int, emoji string) error
- func ToolEmoji(toolName string) string
- type QuestionPage
- type QuestionPageOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EditQuestionMessage ¶
func EditQuestionMessage( botToken string, chatID int64, messageID int, text string, markup *models.InlineKeyboardMarkup, ) error
EditQuestionMessage edits a question message in-place (for pagination/updates).
func ParseChatID ¶
ParseChatID converts a string chat ID to int64.
func RenderCustomInputPrompt ¶
func RenderCustomInputPrompt(p QuestionPage) (string, *models.InlineKeyboardMarkup)
RenderCustomInputPrompt renders the "waiting for typed answer" page.
func RenderQuestionPage ¶
func RenderQuestionPage(p QuestionPage) (string, *models.InlineKeyboardMarkup)
RenderQuestionPage builds the message text and inline keyboard for one question page.
func RenderSubmittedSummary ¶
RenderSubmittedSummary renders the final "answers submitted" summary.
func SendMessage ¶
SendMessage sends a text message to a chat via the Telegram Bot API. Long messages are automatically split at natural boundaries to fit within Telegram's 4096-rune limit.
func SendQuestionMessage ¶
func SendQuestionMessage(botToken string, chatID int64, text string, markup *models.InlineKeyboardMarkup) (int, error)
SendQuestionMessage sends a question with inline keyboard buttons.
func SetReaction ¶ added in v1.0.0
SetReaction sets an emoji reaction on a Telegram message. Setting a new reaction replaces the previous one (Telegram API behavior).
func ToolEmoji ¶ added in v1.0.0
ToolEmoji maps a tool name to a Telegram-allowed reaction emoji. Returns empty string for tools that should not trigger a reaction. Allowed list: https://gist.github.com/Soulter/3f22c8e5f9c7e152e967e8bc28c97fc9
Types ¶
type QuestionPage ¶
type QuestionPage struct {
AgentName string
PageNum int // 1-indexed
TotalPages int
Header string
Text string
Options []QuestionPageOption
AllowCustom bool
SelectedAnswer string // Non-empty if this question was already answered
AllAnswered bool // True if all questions in batch are answered
CallbackPrefix string // Short ID for callback data
QuestionIdx int // 0-indexed question index
}
QuestionPage holds the data needed to render one page of a question batch.
type QuestionPageOption ¶
QuestionPageOption is one option for display in the inline keyboard.