Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
func NewBot ¶
func NewBot(logger *slog.Logger, api telegram.BotAPI, cfg *config.Config, userRepo storage.UserRepository, msgRepo storage.MessageRepository, statsRepo storage.StatsRepository, logRepo storage.LogRepository, factRepo storage.FactRepository, factHistoryRepo storage.FactHistoryRepository, orClient openrouter.Client, speechKitClient yandex.Client, ragService *rag.Service, translator *i18n.Translator) (*Bot, error)
func (*Bot) HandleUpdate ¶
func (*Bot) ProcessUpdate ¶
func (*Bot) SetWebhook ¶
type Chat ¶
type Chat struct {
ID int64 `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Username string `json:"username"`
}
Chat represents a chat.
type Document ¶
type Document struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
FileName string `json:"file_name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
FileSize int `json:"file_size,omitempty"`
}
Document represents a general file (as opposed to photos, voice messages and audio files).
type Message ¶
type Message struct {
MessageID int `json:"message_id"`
From *User `json:"from"`
Chat *Chat `json:"chat"`
Date int `json:"date"`
Text string `json:"text"`
Caption string `json:"caption"`
Photo []PhotoSize `json:"photo"`
Document *Document `json:"document"`
Voice *Voice `json:"voice"`
ForwardOrigin *MessageOrigin `json:"forward_origin"`
IsCommand bool `json:"-"` // This will be determined manually
Command string `json:"-"` // This will be determined manually
CommandArguments string `json:"-"` // This will be determined manually
}
Message represents a message.
type MessageGroup ¶
type MessageGroup struct {
Messages []*telegram.Message
Timer *time.Timer
CancelFunc context.CancelFunc
UserID int64
}
MessageGroup represents a collection of messages from a single user that are processed together.
type MessageGrouper ¶
type MessageGrouper struct {
// contains filtered or unexported fields
}
MessageGrouper handles the grouping of incoming messages from users.
func NewMessageGrouper ¶
func NewMessageGrouper(b *Bot, logger *slog.Logger, turnWait time.Duration, onGroupReady func(ctx context.Context, group *MessageGroup)) *MessageGrouper
NewMessageGrouper creates a new MessageGrouper.
func (*MessageGrouper) AddMessage ¶
func (mg *MessageGrouper) AddMessage(msg *telegram.Message)
AddMessage adds a new message to a user's group.
type MessageOrigin ¶
type MessageOrigin struct {
Type string `json:"type"`
Date int `json:"date"`
SenderUser *User `json:"sender_user,omitempty"`
SenderUserName string `json:"sender_user_name,omitempty"`
SenderChat *Chat `json:"sender_chat,omitempty"`
AuthorSignature string `json:"author_signature,omitempty"`
MessageID int `json:"message_id,omitempty"`
}
MessageOrigin is a union type that can be one of MessageOriginUser, MessageOriginHiddenUser, MessageOriginChat, or MessageOriginChannel.
func (*MessageOrigin) UnmarshalJSON ¶
func (mo *MessageOrigin) UnmarshalJSON(data []byte) error
UnmarshalJSON is a custom unmarshaler for MessageOrigin to handle the union type.
type PhotoSize ¶
type PhotoSize struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Width int `json:"width"`
Height int `json:"height"`
FileSize int `json:"file_size,omitempty"`
}
PhotoSize represents one size of a photo or a file / sticker thumbnail.
type ReactionType ¶
ReactionType represents a reaction type.
type SetMessageReactionConfig ¶
type SetMessageReactionConfig struct {
ChatID int64
MessageID int
Reaction []ReactionType
IsBig bool
}
SetMessageReactionConfig contains information about a reaction to be set on a message.
func (SetMessageReactionConfig) Method ¶
func (config SetMessageReactionConfig) Method() string
Method returns the method name for the SetMessageReaction method.