xp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AutoRankFile string = "data/autoRanks.json"

AutoRankFile is the default file for loading and saving auto promote ranks

View Source
const XpFile string = "data/xp.json"

XpFile is the path where the xp data is saved.

Variables

This section is empty.

Functions

This section is empty.

Types

type AkSession

type AkSession interface {
	GuildMember(guildID string, userID string) (st *dg.Member, err error)
	GuildMembers(guildID string, after string, limit int) (st []*dg.Member, err error)
	GuildRoles(guildID string) (st []*dg.Role, err error)
	GuildMemberRoleAdd(guildID string, userID string, roleID string) (err error)
}

AkSession allows for tests to mock discordgo session method calls

type Data added in v0.11.0

type Data struct {
	Users map[string]float64 `json:"users"`
}

Data holds the experience gained by each user.

type MsgEmbed added in v0.9.0

type MsgEmbed *dg.MessageEmbed

MsgEmbed is used to shorten the name of the original embed type from discordGo

type System

type System struct {
	Data *Data
	// contains filtered or unexported fields
}

System holds all data needed to execute the functionality.

func NewXpStore

func NewXpStore(mtx *sync.Mutex, s *dg.Session) *System

NewXpStore creates the experience data storage map for the session

func (*System) AutoSaveXP

func (x *System) AutoSaveXP()

AutoSaveXP is launched by main.go before accepting new messages. Default time is coded to 5 minutes.

func (*System) Execute

func (x *System) Execute(req []string, msg *dg.MessageCreate) (MsgEmbed, error)

Execute is the method used to run the correct method based on user input.

func (*System) LoadXP

func (x *System) LoadXP(file string) error

LoadXP loads the saved xp data from the json file

func (*System) ManipulateXP

func (x *System) ManipulateXP(action string, msg *dg.MessageCreate)

ManipulateXP is used by any part of the program that needs to read or write data after startup.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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