users

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttendedEvent

type AttendedEvent struct {
	ID   string `json:"id" bson:"_id"`
	Name string `json:"name" bson:"name"`
}

type Demerit

type Demerit struct {
	Giver  User      `json:"giver" bson:"giver"`
	Reason string    `json:"reason" bson:"reason"`
	When   time.Time `json:"when" bson:"when"`
}

type Merit

type Merit struct {
	Giver  User      `json:"giver" bson:"giver"`
	Reason string    `json:"reason" bson:"reason"`
	When   time.Time `json:"when" bson:"when"`
}

type User

type User struct {
	ID             string     `json:"id" bson:"_id"`
	Name           string     `json:"name" bson:"name"`
	Rank           ranks.Rank `json:"rank" bson:"rank"`
	Notes          string     `json:"notes" bson:"notes"`
	Events         int64      `json:"events" bson:"events"`
	LegacyEvents   int64      `json:"legacy_events" bson:"legacy_events"`
	PrimaryOrg     string     `json:"primary_org" bson:"primary_org"`
	RSIMember      bool       `json:"rsi_member" bson:"rsi_member"`
	BadAffiliation bool       `json:"bad_affiliation" bson:"bad_affiliation"`
	Affilations    []string   `json:"affiliations" bson:"affilations"`
	Avatar         string     `json:"avatar" bson:"avatar"`
	Updated        time.Time  `json:"updated" bson:"updated"`
	IsBot          bool       `json:"is_bot" bson:"is_bot"`
	IsAlly         bool       `json:"is_ally" bson:"is_ally"`
	Validated      bool       `json:"validated" bson:"validated"`
	ValidationCode string     `json:"validation_code" bson:"validation_code"`

	Merits   []*Merit   `json:"merits" bson:"merits"`
	Demerits []*Demerit `json:"demerits" bson:"demerits"`

	Playtime  string `json:"playtime" bson:"playtime"`
	Gameplay  string `json:"gamplay" bson:"gameplay"`
	Age       int    `json:"age" bson:"age"`
	Recruiter *User  `json:"recruiter" bson:"recruiter"`

	Discord *discordgo.Member `json:"-" bson:"discord"`
	Access  *auth.UserAccess  `json:"-" bson:"access"`
}

func Get

func Get(id string) (*User, error)

func GetRandom

func GetRandom(max int, maxRank int) ([]User, error)

func New

func New(m *discordgo.Member) *User

func (*User) DecrementEventCount

func (u *User) DecrementEventCount()

func (*User) Delete

func (u *User) Delete() error

func (*User) GetTrueNick

func (u *User) GetTrueNick() string

func (*User) GiveDemerit

func (u *User) GiveDemerit(reason string, who *User) error

func (*User) GiveMerit

func (u *User) GiveMerit(reason string, who *User) error

func (*User) IncrementEventCount

func (u *User) IncrementEventCount()

func (*User) IsAdmin

func (u *User) IsAdmin() bool

func (*User) Issues

func (u *User) Issues() []string

func (*User) Login

func (u *User) Login(code string) error

func (*User) Save

func (u *User) Save() error

func (*User) StillLoggedIn

func (u *User) StillLoggedIn() bool

func (*User) ToMap

func (u *User) ToMap() map[string]interface{}

func (*User) UpdateEventCount

func (u *User) UpdateEventCount(count int64)

type UserError

type UserError error
var (
	UserNotFound UserError = errors.New("user not found")
)

Jump to

Keyboard shortcuts

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