types

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PER_SEARCH_LIMIT = 12
)

Variables

View Source
var MessageTypeFromString = map[string]MessageType{
	"text":     MessageTypeText,
	"photo":    MessageTypePhoto,
	"video":    MessageTypeVideo,
	"document": MessageTypeDocument,
	"voice":    MessageTypeVoice,
	"audio":    MessageTypeAudio,
	"poll":     MessageTypePoll,
	"story":    MessageTypeStory,
}
View Source
var MessageTypeToEmoji = map[MessageType]string{
	MessageTypeText:     "💬",
	MessageTypePhoto:    "🖼️",
	MessageTypeVideo:    "🎥",
	MessageTypeDocument: "📄",
	MessageTypeVoice:    "🎙️",
	MessageTypeAudio:    "🎵",
	MessageTypePoll:     "📊",
	MessageTypeStory:    "🪟",
}
View Source
var (
	StickerFileNames = []string{"sticker.webp", "sticker.webm"}
)

Functions

This section is empty.

Types

type MessageDocument

type MessageDocument struct {
	// Telegram MessageID
	ID   int64 `json:"id"`
	Type int   `json:"type"`
	// The original text of the message
	Message string `json:"message"`
	// The ID of the user who sent the message
	UserID    int64 `json:"user_id"`
	ChatID    int64 `json:"chat_id"`
	Timestamp int64 `json:"timestamp"`
}

type MessageSearchResponse

type MessageSearchResponse struct {
	Hits               []SearchHit `json:"hits,omitempty"`
	ProcessingTimeMs   int64       `json:"processingTimeMs,omitempty"`
	Offset             int64       `json:"offset,omitempty"`
	Limit              int64       `json:"limit,omitempty"`
	EstimatedTotalHits int64       `json:"estimatedTotalHits,omitempty"`
	SemanticHitCount   int64       `json:"semanticHitCount,omitempty"`
	Raw                any
}

type MessageType

type MessageType int
const (
	MessageTypeText MessageType = iota
	MessageTypePhoto
	MessageTypeVideo
	MessageTypeDocument
	MessageTypeVoice
	MessageTypeAudio
	MessageTypePoll
	MessageTypeStory
)

type SearchHit

type SearchHit struct {
	MessageDocument
	Formatted struct {
		ID        string `json:"id"`
		Type      string `json:"type"`
		Message   string `json:"message"`
		UserID    string `json:"user_id"`
		ChatID    string `json:"chat_id"`
		Timestamp string `json:"timestamp"`
	} `json:"_formatted"`
}

type SearchRequest

type SearchRequest struct {
	ChatID      int64         `json:"chat_id"`
	Query       string        `json:"query"`
	ChatIDs     []int64       `json:"chat_ids"`
	TypeFilters []MessageType `json:"type_filters"`
	UserFilters []int64       `json:"user_filters"`
	Limit       int64         `json:"limit"`
	Offset      int64         `json:"offset"`
}

func (SearchRequest) FilterExpression added in v0.6.0

func (r SearchRequest) FilterExpression() string

Jump to

Keyboard shortcuts

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