Documentation ¶
Overview ¶
commands contains the list of commands and messages sent to Discord, or commands processed when received from Discord.
Index ¶
- Constants
- Variables
- func GetAdminHelp() []string
- func GetCommands() (map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate), ...)
- func GetMemberHelp() []string
- func GetThemeNames(map[string]*Theme) ([]string, error)
- func LoadServers() map[string]*Server
- func LoadTargets() map[string]*Targets
- func LoadThemes() map[string]*Theme
- func Start(s *discordgo.Session)
- type BadMessage
- type Config
- type CriminalLevel
- type GoodMessage
- type Heist
- type HeistMemberResult
- type HeistResult
- type Player
- type Server
- type Target
- type Targets
- type Theme
Constants ¶
const ( FREE = "Free" DEAD = "Dead" APPREHENDED = "Apprehended" )
const (
HEIST = "heist"
)
const (
TARGET = "target"
)
const (
THEME = "theme"
)
Variables ¶
Functions ¶
func GetAdminHelp ¶
func GetAdminHelp() []string
GetAdminHelp returns help information about the heist bot for administrators.
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 ret urns the component handlers, command handlers, and commands for the Heist bot.
func GetMemberHelp ¶
func GetMemberHelp() []string
GetMemberHelp returns help information about the heist bot commands for regular members.
func GetThemeNames ¶
GetThemeNames returns a list of available themes.
func LoadServers ¶
LoadServers loads all the heist servers from the store.
func LoadTargets ¶
LoadTargets loads the targets that may be used by the heist bot.
func LoadThemes ¶
LoadThemes loads the themes that may be used by the heist bot.
Types ¶
type BadMessage ¶
type Config ¶
type Config struct { AlertTime time.Time `json:"alert_time" bson:"alert_time"` BailBase int64 `json:"bail_base" bson:"bail_base"` CrewOutput string `json:"crew_output" bson:"crew_output"` DeathTimer time.Duration `json:"death_timer" bson:"death_timer"` Hardcore bool `json:"hardcore" bson:"hardcore"` HeistCost int64 `json:"heist_cost" bson:"heist_cost"` PoliceAlert time.Duration `json:"police_alert" bson:"police_alert"` SentenceBase time.Duration `json:"sentence_base" bson:"sentence_base"` Theme string `json:"theme" bson:"theme"` Targets string `json:"targets" bson:"targets"` WaitTime time.Duration `json:"wait_time" bson:"wait_time"` }
Config is the configuration data for a given server.
type CriminalLevel ¶
type CriminalLevel int
const ( Greenhorn CriminalLevel = 0 Renegade CriminalLevel = 1 Veteran CriminalLevel = 10 Commander CriminalLevel = 25 WarChief CriminalLevel = 50 Legend CriminalLevel = 75 Immortal CriminalLevel = 100 )
func (CriminalLevel) String ¶
func (cl CriminalLevel) String() string
String returns a string representation of the criminal level.
type GoodMessage ¶
type Heist ¶
type Heist struct { Planner string `json:"planner" bson:"planner"` Crew []string `json:"crew" bson:"crew"` Planned bool `json:"planned" bson:"planned"` Started bool `json:"started" bson:"started"` MessageID string `json:"message_id" bson:"message_id"` StartTime time.Time `json:"start_time" bson:"start_time"` Interaction *discordgo.InteractionCreate `json:"-" bson:"-"` Mutex sync.Mutex `json:"-" bson:"-"` }
Heist is the data for a heist that is either planned or being executed.
type HeistMemberResult ¶
type HeistMemberResult struct {
// contains filtered or unexported fields
}
HeistMemberResult is the result for a single player who is a member of the heist crew.
type HeistResult ¶
type HeistResult struct {
// contains filtered or unexported fields
}
HeistResult is the result of a heist.
type Player ¶
type Player struct { ID string `json:"_id" bson:"_id"` BailCost int64 `json:"bail_cost" bson:"bail_cost"` CriminalLevel CriminalLevel `json:"criminal_level" bson:"criminal_level"` DeathTimer time.Time `json:"death_timer" bson:"death_timer"` Deaths int64 `json:"deaths" bson:"deaths"` JailCounter int64 `json:"jail_counter" bson:"jail"` Name string `json:"name" bson:"name"` OOB bool `json:"oob" bson:"oob"` Sentence time.Duration `json:"sentence" bson:"sentence"` Spree int64 `json:"spree" bson:"spree"` Status string `json:"status" bson:"status"` JailTimer time.Time `json:"time_served" bson:"time_served"` TotalJail int64 `json:"total_jail" bson:"total_jail"` }
Player is a specific player of the heist game on a given server.
func NewPlayer ¶
NewPlayer creates a new player. It is typically called when a player first plans or joins a heist.
func (*Player) ClearJailAndDeathStatus ¶
func (p *Player) ClearJailAndDeathStatus()
ClearJailAndDeathStatus removes the jail and death times. This is used if the player is no longer in jail or has been revived.
func (*Player) RemainingDeathTime ¶
RemainingDeathTime returns the amount of time before the player can be resurected.
func (*Player) RemainingJailTime ¶
RemainingJailTime returns the amount of time remaining on the player's sentence has been served.
type Server ¶
type Server struct { ID string `json:"_id" bson:"_id"` Config Config `json:"config" bson:"config"` Players map[string]*Player `json:"players" bson:"players"` Heist *Heist `json:"-" bson:"-"` Targets map[string]*Target `json:"targets" bson:"targets"` Mutex sync.Mutex `json:"-" bson:"-"` }
Server contains the data for a given server with the specific ID.
func GetServer ¶
GetServer returns the server for the guild. If the server does not already exist, one is created.
func NewServer ¶
NewServer creates a new server with the specified ID. It is typically called when the first call from a server is made to the heist bot.
type Target ¶
type Target struct { ID string `json:"_id" bson:"_id"` CrewSize int64 `json:"crew" bson:"crew"` Success float64 `json:"success" bson:"success"` Vault int64 `json:"vault" bson:"vault"` VaultMax int64 `json:"vault_max" bson:"vault_max"` }
Target is a target of a heist.
type Targets ¶
type Targets struct { ID string `json:"_id" bson:"_id"` Targets []Target `json:"targets" bson:"targets"` }
Targets is the set of targets for a given theme
func GetTargetSet ¶
GetTargetSet gets the specified target and returns.
func GetTargets ¶
GetTargets gets the specified list of targets and returns.
type Theme ¶
type Theme struct { ID string `json:"_id" bson:"_id"` Good []GoodMessage `json:"good"` Bad []BadMessage `json:"bad"` Jail string `json:"jail" bson:"jail"` OOB string `json:"oob" bson:"oob"` Police string `json:"police" bson:"police"` Bail string `json:"bail" bson:"bail"` Crew string `json:"crew" bson:"crew"` Sentence string `json:"sentence" bson:"sentence"` Heist string `json:"heist" bson:"heist"` Vault string `json:"vault" bson:"vault"` }
Theme is a heist theme.