levels

package
v0.0.0-...-07de05f Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadgeLimt          = 18
	TimeAtUserFormat   = "Mon, 15:04"
	TimeBirthdayFormat = "01/02"
)

Variables

View Source
var (
	LevelsBucket = &ratelimits.BucketContainer{}

	// How many keys a bucket may contain when created
	BUCKET_INITIAL_FILL int8 = 1

	// The maximum amount of keys a user may possess
	BUCKET_UPPER_BOUND int8 = 1

	// How often new keys drip into the buckets
	DROP_INTERVAL = 60 * time.Second

	// How many keys may drop at a time
	DROP_SIZE int8 = 1
)

Functions

func GetExpForLevel

func GetExpForLevel(level int) int64

func GetLevelFromExp

func GetLevelFromExp(exp int64) int

func GetProgressToNextLevelFromExp

func GetProgressToNextLevelFromExp(exp int64) int

Types

type Cache_Levels_top

type Cache_Levels_top struct {
	GuildID string
	Levels  PairList
}

type Levels

type Levels struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Levels) Action

func (m *Levels) Action(command string, content string, msg *discordgo.Message, session *discordgo.Session)

func (*Levels) BadgePickerActiveText

func (l *Levels) BadgePickerActiveText(username string, activeBadgeIDs []string, availableBadges []models.ProfileBadgeEntry) string

func (*Levels) BadgePickerHelpText

func (l *Levels) BadgePickerHelpText() string

func (*Levels) BadgePickerPrintBadges

func (l *Levels) BadgePickerPrintBadges(user *discordgo.User, channeID string, availableBadges []models.ProfileBadgeEntry, activeBadgeIDs []string, categoryName string, allBadges []models.ProfileBadgeEntry) []string

func (*Levels) BadgePickerPrintCategories

func (l *Levels) BadgePickerPrintCategories(user *discordgo.User, channeID string, availableBadges []models.ProfileBadgeEntry, activeBadgeIDs []string, allBadges []models.ProfileBadgeEntry) []string

func (*Levels) BucketDrain

func (b *Levels) BucketDrain(amount int8, user string) error

Drains $amount from $user if he has enough keys left

func (*Levels) BucketGet

func (b *Levels) BucketGet(user string) int8

func (*Levels) BucketHasKeys

func (b *Levels) BucketHasKeys(user string) bool

Check if the user still has keys

func (*Levels) BucketInit

func (b *Levels) BucketInit()

func (*Levels) BucketRefiller

func (b *Levels) BucketRefiller()

Refills user buckets in a set interval

func (*Levels) BucketSet

func (b *Levels) BucketSet(user string, value int8)

func (*Levels) Commands

func (m *Levels) Commands() []string

func (*Levels) CreateBucketIfNotExists

func (b *Levels) CreateBucketIfNotExists(user string)

Check if the user has a bucket. If not create one

func (*Levels) DeleteMessages

func (l *Levels) DeleteMessages(channelID string, messages []string)

func (*Levels) GetAccentColor

func (m *Levels) GetAccentColor(userUserdata models.ProfileUserdataEntry) string

func (*Levels) GetAvatarOpacity

func (m *Levels) GetAvatarOpacity(userUserdata models.ProfileUserdataEntry) string

func (*Levels) GetBackgroundColor

func (m *Levels) GetBackgroundColor(userUserdata models.ProfileUserdataEntry) string

func (*Levels) GetBackgroundOpacity

func (m *Levels) GetBackgroundOpacity(userUserdata models.ProfileUserdataEntry) string

func (*Levels) GetBadgeOpacity

func (m *Levels) GetBadgeOpacity(userUserdata models.ProfileUserdataEntry) string

func (*Levels) GetDetailOpacity

func (m *Levels) GetDetailOpacity(userUserdata models.ProfileUserdataEntry) string

func (*Levels) GetExpOpacity

func (m *Levels) GetExpOpacity(userUserdata models.ProfileUserdataEntry) string

func (*Levels) GetProfile

func (m *Levels) GetProfile(member *discordgo.Member, guild *discordgo.Guild, gifP bool) ([]byte, string, error)

func (*Levels) GetProfileBackgroundUrl

func (l *Levels) GetProfileBackgroundUrl(userdata models.ProfileUserdataEntry) (link string)

func (*Levels) GetProfileBackgroundUrlByName

func (l *Levels) GetProfileBackgroundUrlByName(backgroundName string) string

func (*Levels) GetProfileHTML

func (m *Levels) GetProfileHTML(member *discordgo.Member, guild *discordgo.Guild, web bool) (string, error)

func (*Levels) GetTextColor

func (m *Levels) GetTextColor(userUserdata models.ProfileUserdataEntry) string

func (*Levels) Init

func (m *Levels) Init(session *shardmanager.Manager)

func (*Levels) OnGuildBanAdd

func (b *Levels) OnGuildBanAdd(user *discordgo.GuildBanAdd, session *discordgo.Session)

func (*Levels) OnGuildBanRemove

func (b *Levels) OnGuildBanRemove(user *discordgo.GuildBanRemove, session *discordgo.Session)

func (*Levels) OnGuildMemberAdd

func (m *Levels) OnGuildMemberAdd(member *discordgo.Member, session *discordgo.Session)

func (*Levels) OnGuildMemberRemove

func (m *Levels) OnGuildMemberRemove(member *discordgo.Member, session *discordgo.Session)

func (*Levels) OnMessage

func (m *Levels) OnMessage(content string, msg *discordgo.Message, session *discordgo.Session)

func (*Levels) OnMessageDelete

func (b *Levels) OnMessageDelete(msg *discordgo.MessageDelete, session *discordgo.Session)

func (*Levels) OnReactionAdd

func (b *Levels) OnReactionAdd(reaction *discordgo.MessageReactionAdd, session *discordgo.Session)

func (*Levels) OnReactionRemove

func (b *Levels) OnReactionRemove(reaction *discordgo.MessageReactionRemove, session *discordgo.Session)

func (*Levels) ProcessMessage

func (m *Levels) ProcessMessage(msg *discordgo.Message, session *discordgo.Session)

func (*Levels) ProfileBackgroundSearch

func (l *Levels) ProfileBackgroundSearch(searchText string) (entryBucket []models.ProfileBackgroundEntry)

func (*Levels) Uninit

func (l *Levels) Uninit(session *shardmanager.Manager)

type Levels_Cache_Ranking_Item

type Levels_Cache_Ranking_Item struct {
	UserID  string
	EXP     int64
	Level   int
	Ranking int
}

type Pair

type Pair struct {
	Key   string
	Value int64
}

type PairList

type PairList []Pair

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

type ProcessExpInfo

type ProcessExpInfo struct {
	GuildID   string
	ChannelID string
	UserID    string
}

Jump to

Keyboard shortcuts

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