Documentation
¶
Index ¶
Constants ¶
View Source
const (
PerSearchLimit = 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 MessageTypeToDisplayString = map[MessageType]string{ MessageTypeText: "文本", MessageTypePhoto: "图片", MessageTypeVideo: "视频", MessageTypeDocument: "文件", MessageTypeVoice: "语音", MessageTypeAudio: "音频", MessageTypePoll: "投票", MessageTypeStory: "动态", }
View Source
var MessageTypeToEmoji = map[MessageType]string{ MessageTypeText: "💬", MessageTypePhoto: "🖼️", MessageTypeVideo: "🎥", MessageTypeDocument: "📄", MessageTypeVoice: "🎙️", MessageTypeAudio: "🎵", MessageTypePoll: "📊", MessageTypeStory: "🪟", }
View Source
var MessageTypeToString = map[MessageType]string{ MessageTypeText: "text", MessageTypePhoto: "photo", MessageTypeVideo: "video", MessageTypeDocument: "document", MessageTypeVoice: "voice", MessageTypeAudio: "audio", MessageTypePoll: "poll", MessageTypeStory: "story", }
View Source
var (
StickerFileNames = []string{"sticker.webp", "sticker.webm", "AnimatedSticker.tgs", "video.mp4", "animation.gif.mp4"}
)
Functions ¶
This section is empty.
Types ¶
type MessageDocument ¶
type MessageDocument struct {
// Telegram message ID
ID int64 `json:"id"`
Type int `json:"type"`
// The original text of the message
Message string `json:"message"`
// The OCRed text of the message
Ocred string `json:"ocred"`
// [TODO] The AI generated text of the message(summarization, caption, tagging, etc.)
AIGenerated string `json:"aigenerated"`
// The ID of the user who sent the message
UserID int64 `json:"user_id"`
ChatID int64 `json:"chat_id"`
Timestamp int64 `json:"timestamp"`
}
type MessageType ¶
type MessageType int
const ( MessageTypeText MessageType = iota MessageTypePhoto MessageTypeVideo MessageTypeDocument MessageTypeVoice MessageTypeAudio MessageTypePoll MessageTypeStory )
type SearchHit ¶
type SearchHit struct {
MessageDocument
Formatted SearchHitFormatted `json:"_formatted"`
}
func (SearchHit) FullFormattedText ¶ added in v1.0.0
func (SearchHit) MessageLink ¶ added in v0.15.0
type SearchHitFormatted ¶ added in v1.0.0
type SearchRequest ¶
type SearchRequest struct {
ChatID int64 `json:"chat_id"`
Query string `json:"query"`
ChatIDs []int64 `json:"chat_ids"`
AllChats bool `json:"all_chats"`
TypeFilters []MessageType `json:"type_filters"`
UserFilters []int64 `json:"user_filters"`
DisableOcred bool `json:"disable_ocred"` // 不搜索 OCR 文字
EnableAIGenerated bool `json:"enable_aigenerated"` // [TODO] 搜索 AI 生成的内容(not implemented yet)
Limit int64 `json:"limit"`
Offset int64 `json:"offset"`
}
func (SearchRequest) FilterExpression ¶ added in v0.6.0
func (r SearchRequest) FilterExpression() (string, error)
type SearchResponse ¶ added in v1.0.0
type SearchResponse 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
}
Click to show internal directories.
Click to hide internal directories.