Documentation
¶
Index ¶
- type Media
- type Store
- func (s *Store) AddPoints(id string, delta int) (*User, error)
- func (s *Store) CheckIn(id string, reward int) (int, *User, error)
- func (s *Store) ClearChatHistory(userID string) error
- func (s *Store) Close() error
- func (s *Store) CountMedia() (int, error)
- func (s *Store) DeleteMedia(id string) error
- func (s *Store) GetChatHistory(userID string) ([]byte, error)
- func (s *Store) GetMedia(id string) (*Media, error)
- func (s *Store) GetModel() (string, error)
- func (s *Store) GetOrCreateUser(id string, username, displayName string) (*User, error)
- func (s *Store) GetRandomMedia() (*Media, error)
- func (s *Store) GetRateLimit() (limit int, ok bool, err error)
- func (s *Store) GetUser(id string) (*User, error)
- func (s *Store) GetVisionEnabled() (bool, error)
- func (s *Store) ListMedia(limit, offset int) ([]Media, error)
- func (s *Store) ListSubscribers() ([]string, error)
- func (s *Store) ListUsers(limit, offset int) ([]User, error)
- func (s *Store) PromoteAdmin(id string) (*User, error)
- func (s *Store) SaveChatHistory(userID string, data []byte) error
- func (s *Store) SaveMedia(id, paramsType, caption string, addedBy string) error
- func (s *Store) SetMediaR2(id, r2Key string) error
- func (s *Store) SetMediaTags(id string, tags []string) error
- func (s *Store) SetModel(model string) error
- func (s *Store) SetPersona(id string, persona string) error
- func (s *Store) SetPoints(id string, points int) (*User, error)
- func (s *Store) SetRateLimit(limit int) error
- func (s *Store) SetVisionEnabled(enabled bool) error
- func (s *Store) Subscribe(chatID string) error
- func (s *Store) Unsubscribe(chatID string) error
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Media ¶
type Media struct {
ID string `json:"id"`
FileID string `json:"file_id"`
Type string `json:"type"` // "photo" or "video"
Caption string `json:"caption"`
AddedBy string `json:"added_by"`
CreatedAt int64 `json:"created_at"`
R2Key string `json:"r2_key,omitempty"` // Key in R2 bucket if uploaded
Tags []string `json:"tags,omitempty"`
}
Media represents a saved telegram photo or video.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists user data and settings to BoltDB.
func (*Store) ClearChatHistory ¶
ClearChatHistory deletes the chat history for a user.
func (*Store) CountMedia ¶
CountMedia returns the total number of media items.
func (*Store) DeleteMedia ¶
DeleteMedia removes a media by ID.
func (*Store) GetChatHistory ¶
GetChatHistory retrieves the chat history for a user.
func (*Store) GetOrCreateUser ¶
GetOrCreateUser retrieves or creates a user.
func (*Store) GetRandomMedia ¶
GetRandomMedia returns a random media from the store.
func (*Store) GetRateLimit ¶
GetRateLimit returns the stored chat rate limit per minute and whether it was set. A stored value <=0 means the rate limit is disabled.
func (*Store) GetVisionEnabled ¶
GetVisionEnabled returns the global vision enabled status.
func (*Store) ListSubscribers ¶
ListSubscribers returns all subscriber IDs
func (*Store) PromoteAdmin ¶
PromoteAdmin promotes a user to admin.
func (*Store) SaveChatHistory ¶
SaveChatHistory persists the chat history for a user.
func (*Store) SetMediaR2 ¶
SetMediaR2 updates the R2Key for a media item.
func (*Store) SetMediaTags ¶
SetMediaTags updates the tags for a media item.
func (*Store) SetPersona ¶
SetPersona saves the user's persona (system prompt customization)
func (*Store) SetRateLimit ¶
SetRateLimit updates the allowed chat requests per minute. A value <=0 disables the limit.
func (*Store) SetVisionEnabled ¶
SetVisionEnabled sets the global vision enabled status.
func (*Store) Unsubscribe ¶
Unsubscribe removes a chat ID
type User ¶
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Points int `json:"points"`
LastCheckin string `json:"last_checkin"`
IsAdmin bool `json:"is_admin"`
DisplayName string `json:"display_name"`
Persona string `json:"persona,omitempty"`
}
User represents a Telegram user state.