rdconf

package
v0.0.0-...-9648343 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustTargets

func MustTargets(tgts []bot.Target, err error) []bot.Target

MustTargets panics if Targets() fails.

Types

type Storage

type Storage struct {
	LoginSet string
	Login2ID string
	ID2Login string
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(name string) *Storage

func (*Storage) AddTarget

func (s *Storage) AddTarget(id, login string) (bool, error)

AddTarget activates a user.

func (*Storage) CachedID

func (s *Storage) CachedID(login string) (id string, err error)

func (*Storage) Config

func (s *Storage) Config(id string) (cfg map[string]string, err error)

func (*Storage) Parted

func (s *Storage) Parted(login string) error

func (*Storage) Reconfigure

func (s *Storage) Reconfigure(id, login string, applycfg map[string]string) (prevlogin string, cfg map[string]string, err error)

func (*Storage) RemoveTarget

func (s *Storage) RemoveTarget(login string) (bool, error)

RemoveTarget deactivates a user. Configuration is retained.

func (*Storage) RenameTarget

func (s *Storage) RenameTarget(prev, next string) (bool, error)

RenameTarget renames a target name, preserving the original configuration.

func (*Storage) StoreConfig

func (s *Storage) StoreConfig(id string, conf map[string]string) (bool, error)

StoreConfig creates or updates the configuration of a target. Keys not set in `conf` are not modified.

func (*Storage) StoreUserID

func (s *Storage) StoreUserID(login, id string) error

StoreUserID syncs the ID for a given login. Intended for cases where we know the login, but didn't know the ID yet.

func (*Storage) Targets

func (s *Storage) Targets() ([]bot.Target, error)

Targets returns a list of active logins so that they can be joined on TMI when the bot starts. Note that there is no guarantee the logins are still up to date at that point in time.

func (*Storage) UserID

func (s *Storage) UserID(login string) string

UserID fetches a cached user ID from a login name.

Jump to

Keyboard shortcuts

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