Documentation ¶
Index ¶
Constants ¶
const SubmissionSaveDuration = 1 * time.Hour
SubmissionSaveDuration is the duration to save submissions for.
Variables ¶
var ErrMemberAlreadyExists = errors.New("a member with your information already exists, contact the server administrator")
ErrMemberAlreadyExists is returned if a member is being registered with an existing member's information.
var ErrNotFound = errors.New("not found")
ErrNotFound is returned if anything is not found.
var ErrUnknownPronouns = errors.New("unknown pronouns")
ErrUnknownPronouns is returned if a Pronouns is unknown. Use NewPronouns and check its error to ensure that it is never invalid.
var KnownPronouns = []Pronouns{ HeHim, SheHer, TheyThem, AnyPronouns, HiddenPronouns, }
Functions ¶
This section is empty.
Types ¶
type ContainsContext ¶
type ContainsContext interface {
WithContext(context.Context) ContainsContext
}
ContainsContext can be embedded by any interface to have an overrideable context.
type Email ¶
type Email string
Email describes an email type.
type EmailHostsVerifier ¶
type EmailHostsVerifier []string
EmailHostsVerifier whitelists hosts allowed for the email.
func (EmailHostsVerifier) String ¶
func (h EmailHostsVerifier) String() string
String returns a label string.
func (EmailHostsVerifier) VerifyEmail ¶
func (h EmailHostsVerifier) VerifyEmail(email Email) error
type EmailVerifier ¶
EmailVerifier is used to verify email addresses' validity. Note that it's not meant to validate its authenticity.
type KnownGuild ¶
type KnownGuildStore ¶
type KnownGuildStore interface { ContainsContext // InitGuild initializes a guild. InitGuild(KnownGuild) error // GuildInfo returns the information about a registered guild. GuildInfo(discord.GuildID) (*KnownGuild, error) // GuildSetAdminRole sets the admin role for the given guild. // This is a field in KnownGuild that is optional. GuildSetAdminRole(discord.GuildID, discord.RoleID) error // DeleteGuild deletes the guild with the given ID from the registered // database. DeleteGuild(discord.GuildID) error }
KnownGuildStore stores all known guilds, or guilds that are using the registration feature.
type Member ¶
type Member struct { GuildID discord.GuildID UserID discord.UserID Metadata MemberMetadata }
type MemberMetadata ¶
type MemberMetadata struct { Email Email `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Pronouns Pronouns `json:"pronouns"` }
func (MemberMetadata) Name ¶
func (m MemberMetadata) Name() string
Name returns the first name and last if any.
func (MemberMetadata) Nickname ¶
func (m MemberMetadata) Nickname() string
Nickname returns the nickname for the given member using their metadata.
type MemberStore ¶
type MemberStore interface { ContainsContext // MemberInfo returns the member's info for the given user. MemberInfo(discord.GuildID, discord.UserID) (*MemberMetadata, error) // RegisterMember registers the given member into the store. RegisterMember(Member) error // UnregisterMember unregisters the given member from the store. UnregisterMember(discord.GuildID, discord.UserID) error }
MemberStore stores all registered members.
type Pronouns ¶
type Pronouns string
Pronouns describes a pronouns string in the format (they/them).
func NewPronouns ¶
NewPronouns creates a new Pronouns value. An error is returned if the pronouns are invalid.
type Store ¶
type Store interface { io.Closer ContainsContext KnownGuildStore MemberStore SubmissionStore }
Store describes a Store instance. It combines all smaller stores.
type SubmissionStore ¶
type SubmissionStore interface { ContainsContext // SaveSubmission temporarily saves a submission. The submission doesn't // have to be valid. SaveSubmission(Member) error // RestoreSubmission returns a saved submission. RestoreSubmission(discord.GuildID, discord.UserID) (*MemberMetadata, error) }
SubmissionStore stores submissions for a short while so that forms can be temproarily stored.
Directories ¶
Path | Synopsis |
---|---|
Package env contains environment variable bindings to acmregister settings.
|
Package env contains environment variable bindings to acmregister settings. |