telegram

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

func ParseChatID(s string) (int64, error)

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

func RenderSubmittedSummary(agentName string, questions []string, answers []string) string

RenderSubmittedSummary renders the final "answers submitted" summary.

func SendMessage

func SendMessage(botToken, chatID, text string) error

SendMessage sends a text message to a chat via the Telegram Bot API.

func SendQuestionMessage

func SendQuestionMessage(botToken string, chatID int64, text string, markup *models.InlineKeyboardMarkup) (int, error)

SendQuestionMessage sends a question with inline keyboard buttons.

func SendVoice

func SendVoice(botToken string, chatID int64, oggData []byte) error

SendVoice sends an OGG audio file as a voice message via Telegram Bot API.

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

type QuestionPageOption struct {
	Label       string
	Description string
	Selected    bool
}

QuestionPageOption is one option for display in the inline keyboard.

Jump to

Keyboard shortcuts

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