persistence

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SessionMarshaller

func SessionMarshaller() ([]byte, error)

SessionMarshaller implementation for YamlDB

Types

type Session

type Session struct {
	Login        string  `yaml:":login"`
	Timezone     string  `yaml:":timezone"`
	KeepOnline   bool    `yaml:":keeponline"`
	RawMessages  bool    `yaml:":rawmessages"`
	AsciiArrows  bool    `yaml:":asciiarrows"`
	OOBMode      bool    `yaml:":oobmode"`
	Carbons      bool    `yaml:":carbons"`
	HideIds      bool    `yaml:":hideids"`
	Receipts     bool    `yaml:":receipts"`
	NativeEdits  bool    `yaml:":nativeedits"`
	IgnoredChats []int64 `yaml:":ignoredchats"`
	// contains filtered or unexported fields
}

Session is a key-values subtree

func (*Session) Get

func (s *Session) Get(key string) (string, error)

Get retrieves a session value

func (*Session) IgnoreChat added in v1.9.4

func (s *Session) IgnoreChat(chatID int64) bool

IgnoreChat adds a chat id to ignore list, returns false if already ignored

func (*Session) IsChatIgnored added in v1.9.4

func (s *Session) IsChatIgnored(chatID int64) bool

IsChatIgnored checks the chat id against the ignore list

func (*Session) Set

func (s *Session) Set(key string, value string) (string, error)

Set sets a session value

func (*Session) TimezoneToLocation

func (s *Session) TimezoneToLocation() *time.Location

TimezoneToLocation tries to convert config timezone to location

func (*Session) ToMap

func (s *Session) ToMap() map[string]string

ToMap converts the session to a map

func (*Session) UnignoreChat added in v1.9.4

func (s *Session) UnignoreChat(chatID int64) bool

UnignoreChat removes a chat id from ignore list, returns false if not already ignored

type SessionsMap

type SessionsMap struct {
	Sessions map[string]Session `yaml:":sessions"`
}

SessionsMap is for :sessions: subtree

type SessionsYamlDB

type SessionsYamlDB struct {
	yamldb.YamlDB
	Data *SessionsMap
}

SessionsYamlDB wraps YamlDB with Session

func LoadSessions

func LoadSessions(path string) (*SessionsYamlDB, error)

LoadSessions restores TDlib sessions from the previous run

Jump to

Keyboard shortcuts

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