Documentation
¶
Index ¶
- Constants
- Variables
- func GetAdminHelp() []string
- func GetCommands() (map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate), ...)
- func GetCurrentLeaderboard(serverID string, limit int) []*leaderboardAccount
- func GetCurrentRanking(serverID string, memberID string) int
- func GetLifetimeLeaderboard(serverID string, limit int) []*leaderboardAccount
- func GetLifetimeRanking(serverID string, memberID string) int
- func GetMemberHelp() []string
- func GetMonthlyLeaderboard(serverID string, limit int) []*leaderboardAccount
- func GetMonthlyRanking(serverID string, memberID string) int
- func GetRanking(accounts []*Account, memberID string, sortFunc func(i, j int) bool) int
- func LoadBanks()
- func SaveBank(bank *Bank)
- func Start(s *discordgo.Session)
- type Account
- type Bank
- type BankStore
Constants ¶
const (
ECONOMY = "economy"
)
Variables ¶
var ErrAccountAlreadyExist = errors.New("account already exists")
var ErrInsufficintBalance = errors.New("account has insufficent funds")
var ErrNoAccount = errors.New("the account does not exist")
var ErrSameSenderAndReceiver = errors.New("the transmitter and receiver are the same account")
Functions ¶
func GetAdminHelp ¶
func GetAdminHelp() []string
GetAdminHelp returns help information about the heist bot commands
func GetCommands ¶
func GetCommands() (map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate), map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate), []*discordgo.ApplicationCommand)
GetCommands returns the component handlers, command handlers, and commands for the payday bot.
func GetCurrentLeaderboard ¶
GetCurrentLeaderboard returns the top `limit` accounts for the server.
func GetCurrentRanking ¶
GetCurrentRanking returns the global ranking on the server for a given player.
func GetLifetimeLeaderboard ¶
GetLifetimeLeaderboard returns the top `limit` accounts for the server.
func GetLifetimeRanking ¶
GetLifetimeRanking returns the global ranking on the server for a given player.
func GetMemberHelp ¶
func GetMemberHelp() []string
GetHelp returns help information about the heist bot commands
func GetMonthlyLeaderboard ¶
GetMonthlyLeaderboard returns the top `limit` accounts for the server.
func GetMonthlyRanking ¶
GetMonthlyRanking returns the global ranking on the server for a given player.
func GetRanking ¶
GetRanking returns the ranking for the given member for various economy leaderboards. The sortFunc passed in determines how the rankings are determined.
Types ¶
type Account ¶
type Account struct { ID string `json:"_id" bson:"_id"` MonthlyBalance int `json:"monthly_balance" bson:"monthly_balance"` CurrentBalance int `json:"current_balance" bson:"current_balance"` LifetimeBalance int `json:"lifetime_balance" bson:"lifetime_balance"` CreatedAt time.Time `json:"created_at" bson:"created_at"` Name string `json:"name" bson:"name"` // contains filtered or unexported fields }
Account is the bank account for a member of the server/guild.
func (*Account) DepositCredits ¶
DepositCredits adds the amount of credits to the account at a given bank
func (*Account) WithdrawCredits ¶
WithDrawCredits deducts the amount of credits from the account at the given bank
type Bank ¶
type Bank struct { ID string `json:"_id" bson:"_id"` BankName string `json:"bank_name" bson:"bank_name"` Currency string `json:"currency" bson:"currency"` DefaultBalance int `json:"default_balance" bson:"default_balance"` Accounts map[string]*Account `json:"accounts" bson:"accounts"` LastSeason time.Time `json:"last_season" bson:"last_season"` ChannelID string `json:"channel_id" bson:"channel_id"` // contains filtered or unexported fields }
Bank is the repository for all accounts for a given server/guild.