Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Expectation ¶
type Expectation string
const ( ExpectNothing Expectation = "" ExpectLanguage Expectation = "lang" ExpectAuthToken Expectation = "token" ExpectComment Expectation = "comment" )
type SentMsgRec ¶
type State ¶
type State struct { ID types.TgChatID Language language.Tag UserID uuid.UUID AccessToken string LastEventID uuid.UUID Expectation Expectation ReactToMessageID int CommentToPostID uuid.UUID CommentPrefix string }
State is the saved state of a chat.
func NewChatState ¶
func (*State) ClearExpectations ¶
func (s *State) ClearExpectations()
func (*State) IsAuthorized ¶
IsAuthorized returns true if the user is authorized.
func (*State) IsPausedExpectation ¶
type Store ¶
type Store interface { // LoadState returnd state by chatID or nil if there is no state LoadState(chatID types.TgChatID) (*State, error) SaveState(state *State) error DeleteState(chatID types.TgChatID) error ListIDs() ([]types.TgChatID, error) // EventsQueue AddToQueue(chatID types.TgChatID, entry json.RawMessage) error LoadAndDeleteQueue(chatID types.TgChatID) ([]json.RawMessage, error) // EventsStore GetMsgRec(chatID types.TgChatID, messageID int) (SentMsgRec, error) PutMsgRec(chatID types.TgChatID, rec SentMsgRec) error // Tracked posts TrackPost(chatID types.TgChatID, postID uuid.UUID) error UntrackPost(chatID types.TgChatID, postID uuid.UUID) error IsPostTracked(chatID types.TgChatID, postID uuid.UUID) (bool, error) TrackedEntities(chatID types.TgChatID) (TrackedEntities, error) }
Store abstracts database interface.
func NewFsStore ¶
NewFsStore creates a new file-based Store.
type TrackedEntities ¶
Click to show internal directories.
Click to hide internal directories.