levels

package
v0.0.0-...-e364c34 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AverageColour

func AverageColour(img image.Image) (red uint8, green uint8, blue uint8, alpha uint8)

AverageColour gets the average colour from an image. Return values are R, G, B, A respectively.

func Init

func Init(b *bot.Bot)

func LevelFromXP

func LevelFromXP(xp int64) (level int64)

LevelFromXP returns the level of the given XP

func XPFromLevel

func XPFromLevel(level int64) (xp int64)

XPFromLevel returns the XP needed for the given level.

Types

type Bot

type Bot struct {
	*bot.Bot
}

type GuildConfig

type GuildConfig struct {
	ID discord.GuildID `json:"-"`

	BlockedChannels   []uint64 `json:"blocked_channels"`
	BlockedRoles      []uint64 `json:"blocked_roles"`
	BlockedCategories []uint64 `json:"blocked_categories"`

	RewardLog   discord.ChannelID `json:"reward_log"`
	NolevelsLog discord.ChannelID `json:"nolevels_log"`

	BetweenXP  time.Duration `json:"between_xp"`
	RewardText string        `json:"reward_text"`

	LevelsEnabled bool `json:"enabled"`
	DMOnReward    bool `json:"dm_on_reward"`
}

type LevelBackground

type LevelBackground struct {
	ID     int64
	Name   string
	Source string
	Blob   []byte

	EmojiName string
	EmojiID   *discord.EmojiID
}

type LevelReward

type LevelReward struct {
	GuildID    discord.GuildID `json:"-"`
	Level      int64           `db:"lvl" json:"lvl"`
	RoleReward discord.RoleID  `json:"role"`
}

type Nolevels

type Nolevels struct {
	GuildID discord.GuildID
	UserID  discord.UserID
	Expires bool
	Expiry  time.Time

	LogChannel discord.ChannelID // not in table, used for expiry loop
}

type UserLevel

type UserLevel struct {
	GuildID discord.GuildID `json:"-"`
	UserID  discord.UserID  `json:"user_id"`

	XP int64 `json:"xp"`

	Colour     discord.Color `json:"colour"`
	Background *int64        `json:"-"`

	LastXP time.Time `json:"-"`
}

Jump to

Keyboard shortcuts

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