Documentation
¶
Index ¶
Constants ¶
const ( TrialStateOpen = "open" TrialStateClosed = "closed" )
State Constants
Variables ¶
var ErrBadSetting = errors.New("bad setting")
ErrBadSetting is the error returned if an unknown setting is accessed
var ErrGuildNotExist = errors.New("guild does not exist")
ErrGuildNotExist is the error returned if a guild does not exist
var ErrTrialNotExist = errors.New("trial does not exist")
ErrTrialNotExist is the error returned if a trial does not exist
Functions ¶
This section is empty.
Types ¶
type Guild ¶
type Guild interface { GetName() string GetSettings() GuildSettings SetName(name string) SetSettings(s GuildSettings) Serialize() ([]byte, error) }
Guild is the api for managing guild settings for a particular guild
type GuildAPI ¶
type GuildAPI interface {
NewTransaction(writable bool) (GuildAPITx, error)
}
GuildAPI is the api for managing guild settings transactions
type GuildAPITx ¶
type GuildAPITx interface { Commit() error Rollback() error GetGuild(name string) (Guild, error) AddGuild(name string) (Guild, error) SaveGuild(guild Guild) error }
GuildAPITx is the api for managing guild settings within a transaction
type GuildSettings ¶
type GuildSettings struct { ControlSequence string AnnounceChannel string SignupChannel string AdminChannel string AnnounceTo string ShowAfterSignup string ShowAfterWithdraw string }
GuildSettings is the set of configuration settings for a guild
func GetSettings ¶ added in v0.1.3
func GetSettings(gapi GuildAPI, guild string) (s GuildSettings, err error)
GetSettings is a wrapper to get the configuration settings for a guild
NOTE: this cannot be called after another transaction has been started
func (*GuildSettings) GetSettingString ¶
func (s *GuildSettings) GetSettingString(name string) (string, error)
GetSettingString gets the value of a setting
func (*GuildSettings) PrettyString ¶
func (s *GuildSettings) PrettyString() string
PrettyString returns a multi-line string describing the settings
func (*GuildSettings) SetSettingString ¶
func (s *GuildSettings) SetSettingString(name, val string) error
SetSettingString sets the value of a setting
type Trial ¶
type Trial interface { GetName() string GetDescription() string GetAnnounceChannel() string GetSignupChannel() string GetState() TrialState GetSignups() []TrialSignup GetRoleCounts() []RoleCount SetName(name string) SetDescription(d string) SetAnnounceChannel(val string) SetSignupChannel(val string) SetState(state TrialState) AddSignup(name, role string) RemoveSignup(name string) SetRoleCount(name, emoji string, ct uint64) RemoveRole(name string) Serialize() ([]byte, error) }
Trial is the api for managing a particular trial
type TrialAPI ¶
type TrialAPI interface {
NewTransaction(guild string, writable bool) (TrialAPITx, error)
}
TrialAPI is the API for managing trials transactions
type TrialAPITx ¶
type TrialAPITx interface { Commit() error Rollback() error GetTrial(name string) (Trial, error) AddTrial(name string) (Trial, error) SaveTrial(trial Trial) error DeleteTrial(name string) error GetTrials() []Trial }
TrialAPITx is the api for managing trials within a transaction
type TrialSignup ¶
TrialSignup is the api for managing a signup for a trial