Documentation ¶
Index ¶
- Constants
- type AkSession
- type Exp
- type MsgEmbed
- type System
- func (x *System) AutoPromote(msg *dg.MessageCreate) error
- func (x *System) AutoSaveXP()
- func (x *System) Execute(req []string, msg *dg.MessageCreate) (MsgEmbed, error)
- func (x *System) LoadAutoRanks(file string) error
- func (x *System) LoadXP(file string) error
- func (x *System) ManipulateXP(action string, msg *dg.MessageCreate)
Constants ¶
const AutoRankFile string = "data/autoRanks.json"
AutoRankFile is the default file for loading and saving auto promote ranks
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 Exp ¶
type Exp interface { LoadXP(file string) error ManipulateXP(action string, msg *dg.MessageCreate) AutoSaveXP() Execute(req []string, msg *dg.MessageCreate) (MsgEmbed, error) AutoPromote(msg *dg.MessageCreate) error LoadAutoRanks(file string) error }
Exp is the interface for interacting with the xp methods
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 {
// contains filtered or unexported fields
}
System holds all data needed to execute the functionality.
func (*System) AutoPromote ¶
func (x *System) AutoPromote(msg *dg.MessageCreate) error
AutoPromote checks the user's current XP after each messag sent and promotes the user to the correct role if crosses a certain threshold.
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) LoadAutoRanks ¶
LoadAutoRanks 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.