Documentation
¶
Index ¶
- Constants
- Variables
- func AddBoostTokens(s *discordgo.Session, i *discordgo.InteractionCreate, setCountWant int, ...) (int, int, error)
- func AddBoostTokensInteraction(s *discordgo.Session, i *discordgo.InteractionCreate, setCountWant int, ...)
- func AddContractMember(s *discordgo.Session, guildID string, channelID string, operator string, ...) error
- func AdminContractReport(s *discordgo.Session, i *discordgo.InteractionCreate, contract *Contract, ...)
- func ArchiveContracts(s *discordgo.Session)
- func Boosting(s *discordgo.Session, guildID string, channelID string) error
- func ChangeBoostOrder(s *discordgo.Session, guildID string, channelID string, userID string, ...) (string, error)
- func ChangeContractIDs(s *discordgo.Session, guildID string, channelID string, userID string, ...) (int, error)
- func ChangeCurrentBooster(s *discordgo.Session, guildID string, channelID string, userID string, ...) error
- func CheckCoopStatusPermission(s *discordgo.Session, i *discordgo.InteractionCreate, ...) bool
- func CheckLeaderboardPermission(s *discordgo.Session, i *discordgo.InteractionCreate) bool
- func ContractReport(s *discordgo.Session, i *discordgo.InteractionCreate, ...) error
- func CreatePredictedContract() []ei.EggIncContract
- func DeleteContract(s *discordgo.Session, guildID string, channelID string) (string, error)
- func DownloadCoopStatusStones(contractID string, coopID string, details bool, soloName string, ...) (string, string, []*discordgo.MessageEmbedField)
- func DrawBoostList(s *discordgo.Session, contract *Contract) []discordgo.MessageComponent
- func EncodeSandboxData(cxpToggle bool, targetEgg float64, tokenTimer string, ...) (string, error)
- func FindEggEmoji(eggOrig string) string
- func FinishContract(s *discordgo.Session, contract *Contract)
- func FmtActiveModifier(c *ei.EggIncContract) (string, int)
- func FmtNumberSingleUnit(v float64, srSandboxOrdering bool) (string, int)
- func GenerateContractSandboxData(contract *Contract, players []SandboxPlayer) (string, error)
- func GenerateContractSandboxDataWithOptions(contract *Contract, players []SandboxPlayer, options *ContractSandboxOptions) (string, error)
- func GenerateContractSandboxURL(contract *Contract, players []SandboxPlayer) (string, error)
- func GenerateContractSandboxURLWithOptions(contract *Contract, players []SandboxPlayer, options *ContractSandboxOptions) (string, error)
- func GetAvailabilityComponents(s *discordgo.Session, contract *Contract, userID string) []discordgo.MessageComponent
- func GetContractArchivesForNames(s *discordgo.Session, names []string, cxpVersion string, forceRefresh bool, ...) (archives [][]*ei.LocalContract, fetched []bool, missing []string, err error)
- func GetContractDescription(channelID string) string
- func GetContractEstimateString(contractID string, includeLeggySet bool, teOverride ...float64) string
- func GetEggStandardTime(t time.Time) time.Time
- func GetHelp(s *discordgo.Session, guildID string, channelID string, userID string) *discordgo.MessageSend
- func GetPredCommand(cmd string) *discordgo.ApplicationCommand
- func GetPredictedTimes() (map[string]time.Time, map[string]time.Time)
- func GetPredictionBrackets() (wed, friPE, friUltra []ei.EggIncContract)
- func GetPredictionsCommand(cmd string) *discordgo.ApplicationCommand
- func GetRoleNamesForContract(contractID string) ([]string, error)
- func GetSignupComponents(contract *Contract) (string, []discordgo.MessageComponent)
- func GetSlashAdminContractsListCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashAvailabilityCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashBoostCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashBoostOrderCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashBumpCRCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashBumpCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashCalcContractTval(cmd string) *discordgo.ApplicationCommand
- func GetSlashChangeCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashChangeOneBoosterCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashChangePlannedStartCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashChangeSpeedRunSinkCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashContractCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashContractReportCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashContractSettingsCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashCoopETACommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashCoopTval(cmd string) *discordgo.ApplicationCommand
- func GetSlashCsEstimates(cmd string) *discordgo.ApplicationCommand
- func GetSlashEstimateTime(cmd string) *discordgo.ApplicationCommand
- func GetSlashHelpCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashJoinContractCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashLeaderboard(cmd string) *discordgo.ApplicationCommand
- func GetSlashLinkAlternateCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashLobbyCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashPruneCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashRegisterAltCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashRegisterCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashRenameThread(cmd string) *discordgo.ApplicationCommand
- func GetSlashRerunEvalCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashScoreExplorerCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashSkipCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashSpeedrunCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashStones(cmd string) *discordgo.ApplicationCommand
- func GetSlashTeamworkEval(cmd string) *discordgo.ApplicationCommand
- func GetSlashToggleContractPingsCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashTokenEditCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashUnboostCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashUpdateCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashUploadBannerCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashVirtueCommand(cmd string) *discordgo.ApplicationCommand
- func GetSlashVolunteerSink(cmd string) *discordgo.ApplicationCommand
- func GetSlashVoluntellSink(cmd string) *discordgo.ApplicationCommand
- func GetTargetBuffTimeValue(cxpVersion int, durationSec float64) float64
- func GetTargetTval(cxpVersion int, contractMinutes float64, minutesPerToken float64) float64
- func GetThematicComplaintsForContract(contractID string) ([]string, error)
- func GetWish(guildID string, channelID string) string
- func HandleActiveContractsPage(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminContractList(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminContractListComponent(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminCurrentContracts(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminExitButton(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminExitCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminGetContractData(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminGuildStateAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminGuildStateCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminListRoles(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminMembers(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminStatusMessageAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAdminStatusMessageCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAllContractsAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAltsAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleArtifactAltAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleArtifactCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleArtifactReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleAvailabilityCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleBoostCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleBoostOrderCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleBoostOrderReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleBumpCRCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleBumpCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleChangeCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleChangeOneBoosterCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleChangePlannedStartCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleChangeSpeedrunSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleChartReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractCalcContractTvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractDelete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractReport(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractSettingsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleContractSettingsReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleCoopAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleCoopETACommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleCoopStatusPermissionButton(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleCoopTvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleCsEstimateButtons(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleCsEstimatesCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleEggIDModalSubmit(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleEstimateTimeCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleHelpCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleJoinCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLeaderboard(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLeaderboardAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLeaderboardPage(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLeaderboardPermissionButton(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLinkAlternateAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLinkAlternateCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLobbyButtons(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleLobbyCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleMenuReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandlePredCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandlePredPage(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandlePredictionsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandlePredictionsPage(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandlePruneCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleRegister(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleRegisterAlt(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleRegisterAltAutocomplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleRenameThreadCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleReplayEval(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleRestartContract(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleScoreExplorerCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleScoreExplorerPage(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSignupBell(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSignupFarmer(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSignupLeave(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSignupStart(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSkipCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSlashVolunteerSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSlashVoluntellSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleSpeedrunCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleStonesCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleStonesPage(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleTeamworkEvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleTeamworkPage(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleToggleContractPingsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleTokenEditAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleTokenEditCommand(s *discordgo.Session, i *discordgo.InteractionCreate) string
- func HandleTokenEditInteraction(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleTokenIDAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate) (string, []*discordgo.ApplicationCommandOptionChoice)
- func HandleTokenListAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate) (string, []*discordgo.ApplicationCommandOptionChoice)
- func HandleTokenReceiverAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate) (string, []*discordgo.ApplicationCommandOptionChoice)
- func HandleUnboostCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleUpdateCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleUploadBannerCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
- func HandleVirtue(s *discordgo.Session, i *discordgo.InteractionCreate)
- func IsRoleCreatedByBot(roleName string) bool
- func IsUserCreatorOfAnyContract(s *discordgo.Session, userID string) bool
- func JoinContract(s *discordgo.Session, guildID string, channelID string, userID string, ...) error
- func LoadContractData(filename string)
- func LoadEggscapeCoopIDs(filename string)
- func LoadRoleNames() (map[string][]string, error)
- func LoadThematicComplaints() (map[string][]string, error)
- func MoveBooster(s *discordgo.Session, guildID string, channelID string, userID string, ...) error
- func PopulateContractFromProto(contractProtoBuf *ei.Contract) ei.EggIncContract
- func PopulateThematicComplaintsForContractID(contractID string, complaints []string)
- func PrevContractScoresFromArchives(archives [][]*ei.LocalContract, fetched []bool, ...) (prev []float64, foundPrev []bool)
- func ReactionAdd(s *discordgo.Session, r *discordgo.MessageReaction) string
- func ReactionRemove(s *discordgo.Session, r *discordgo.MessageReaction)
- func RedrawBoostList(s *discordgo.Session, guildID string, channelID string) error
- func RefreshGuildContractsForBannerUpdate(s *discordgo.Session, guildID string)
- func Register(s *discordgo.Session, i *discordgo.InteractionCreate, encryptedID string, ...)
- func RegisterAlt(s *discordgo.Session, i *discordgo.InteractionCreate, targetAlt string, ...)
- func RemoveAddedReaction(s *discordgo.Session, r *discordgo.MessageReaction)
- func RemoveFarmerByMention(s *discordgo.Session, guildID string, channelID string, operator string, ...) error
- func RenderScoreTableANSI(rows []srRow, srmode bool, includeDiff bool) string
- func RequestEggIncIDModal(s *discordgo.Session, i *discordgo.InteractionCreate, action string, ...)
- func RerunEval(s *discordgo.Session, i *discordgo.InteractionCreate, ...)
- func SaveAllData()
- func SaveRoleNames(data map[string][]string)
- func SaveThematicComplaints(data map[string][]string) error
- func SendSandboxDM(s *discordgo.Session, contract *Contract, userID string) error
- func SetListMessageID(contract *Contract, channelID string, messageID string)
- func SetReactionID(contract *Contract, channelID string, reactionID string)
- func SetWish(guildID string, channelID string, wish string) error
- func ShowCoopStatusPermissionDialog(s *discordgo.Session, i *discordgo.InteractionCreate)
- func ShowLeaderboardPermissionDialog(s *discordgo.Session, i *discordgo.InteractionCreate)
- func SkipBooster(s *discordgo.Session, guildID string, channelID string, userID string) error
- func SlashAdminCurrentContracts(cmd string) *discordgo.ApplicationCommand
- func SlashAdminExitCommand(cmd string) *discordgo.ApplicationCommand
- func SlashAdminGetContractData(cmd string) *discordgo.ApplicationCommand
- func SlashAdminGuildStateCommand(cmd string) *discordgo.ApplicationCommand
- func SlashAdminListRoles(cmd string) *discordgo.ApplicationCommand
- func SlashAdminMembers(cmd string) *discordgo.ApplicationCommand
- func SlashAdminStatusMessageCommand(cmd string) *discordgo.ApplicationCommand
- func SlashArtifactsCommand(cmd string) *discordgo.ApplicationCommand
- func StartContractBoosting(s *discordgo.Session, guildID string, channelID string, userID string) error
- func Unboost(s *discordgo.Session, guildID string, channelID string, mention string) error
- func UpdateAllContractsEggInfo()
- func UpdateBannerURL(contract *Contract)
- func UpdateContractTime(contractID string, coopID string, startTime, endTime time.Time, ...)
- func UpdatePredictedSignupContracts(s *discordgo.Session, liveContracts []ei.EggIncContract) int
- func UpdateThreadName(s *discordgo.Session, contract *Contract)
- func UserBoost(s *discordgo.Session, guildID string, channelID string, userID string) error
- func UserInContract(c *Contract, u string) bool
- func Virtue(s *discordgo.Session, i *discordgo.InteractionCreate, ...)
- type ArtifactSet
- type BankerInfo
- type Bookmark
- type Booster
- type CompMap
- type Contract
- func CreateContract(s *discordgo.Session, contractID string, coopID string, playStyle int, ...) (*Contract, error)
- func FindContract(channelID string) *Contract
- func FindContractByHash(hash string) *Contract
- func FindContractByIDs(contractID string, coopID string) *Contract
- func FindContractByMessageID(channelID string, messageID string) *Contract
- type ContractAvailability
- type ContractComplaint
- type ContractDatum
- type ContractDurationEstimate
- type ContractRole
- type ContractSandboxOptions
- type ContractScore
- type DBTX
- type DeliveryTimeValue
- type DynamicTokenData
- type ExternalContractBookmark
- type GetActiveContractsRow
- type InsertContractComplaintParams
- type InsertContractParams
- type InsertContractRoleParams
- type LocationData
- type ParsedFarmer
- type PlayerScoreParameters
- type PredictionInfo
- type Queries
- func (q *Queries) CountContractsByChannel(ctx context.Context, channelid string) (int64, error)
- func (q *Queries) DeleteAllContractComplaints(ctx context.Context) error
- func (q *Queries) DeleteAllContractRoles(ctx context.Context) error
- func (q *Queries) DeleteContractByChannel(ctx context.Context, channelid string) error
- func (q *Queries) DeleteContractComplaints(ctx context.Context, contractid string) error
- func (q *Queries) DeleteContractRoles(ctx context.Context, contractid string) error
- func (q *Queries) GetActiveContracts(ctx context.Context) ([]GetActiveContractsRow, error)
- func (q *Queries) GetContractByChannelID(ctx context.Context, channelid string) (ContractDatum, error)
- func (q *Queries) GetContractComplaints(ctx context.Context) ([]ContractComplaint, error)
- func (q *Queries) GetContractRoles(ctx context.Context) ([]ContractRole, error)
- func (q *Queries) InsertContract(ctx context.Context, arg InsertContractParams) error
- func (q *Queries) InsertContractComplaint(ctx context.Context, arg InsertContractComplaintParams) error
- func (q *Queries) InsertContractRole(ctx context.Context, arg InsertContractRoleParams) error
- func (q *Queries) UpdateContract(ctx context.Context, arg UpdateContractParams) (int64, error)
- func (q *Queries) UpdateContractCoopID(ctx context.Context, arg UpdateContractCoopIDParams) error
- func (q *Queries) UpdateContractState(ctx context.Context, arg UpdateContractStateParams) error
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type SandboxPlayer
- type ScoreCalcParams
- type TeamworkOutputData
- type TokenUnit
- type UpdateContractCoopIDParams
- type UpdateContractParams
- type UpdateContractStateParams
Constants ¶
const ( // CoopStatusPermissionKey is the key used to store the timestamp of when the user allowed CoopStatus permissions CoopStatusPermissionKey = "allow_coop_status" // CoopStatusPermissionSpanKey is the key used to store the selected permission duration (24h or 7d) CoopStatusPermissionSpanKey = "allow_coop_status_span" // CoopStatusPermission24h is the duration for 24 hours permission CoopStatusPermission24h = 24 * time.Hour // CoopStatusPermission7d is the duration for 7 days permission CoopStatusPermission7d = 7 * 24 * time.Hour )
const ( // LeaderboardPermissionKey is the key used to store the timestamp of when the user allowed leaderboard API permissions LeaderboardPermissionKey = "allow_leaderboard_api" // LeaderboardPermissionSpanKey holds the selected permission duration ("24h" or "forever") LeaderboardPermissionSpanKey = "allow_leaderboard_api_span" // LeaderboardPermission24h is the duration for 24 hours permission LeaderboardPermission24h = 24 * time.Hour )
const ( ContractOrderSignup = 0 // Signup order ContractOrderReverse = 1 // Reverse order ContractOrderRandom = 2 // Randomized when the contract starts. After 20 minutes the order changes to Sign-up. ContractOrderFair = 3 // Fair based on position percentile of each farmers last 5 contracts. Those with no history use 50th percentile ContractOrderTimeBased = 4 // Time based order ContractOrderELR = 5 // ELR based order ContractOrderTVal = 6 // Token Value based order ContractOrderTokenAsk = 7 // Token Ask order, less tokens boosts earlier ContractOrderTE = 8 // Truth Egg based order ContractOrderTEFuzzy = 9 // Truth Egg + randomization ContractManualOrder = 10 // Manual order set by contract creator ContractStateSignup = 0 // Contract is in signup phase ContractStateFastrun = 1 // Contract in Boosting as fastrun ContractStateWaiting = 2 // Waiting for other(s) to join ContractStateCompleted = 3 // Contract is completed ContractStateArchive = 4 // Contract is ready to archive //ContractStateDeprecated = 5 // Deprecated ContractStateBanker = 6 // Contract is Boosting with Banker BoostStateUnboosted = 0 // Unboosted BoostStateTokenTime = 1 // TokenTime or turn to receive tokens BoostStateBoosted = 2 // Boosted BoostOrderTimeThreshold = 20 // minutes to switch from random or fair to signup // These are used for the /speedrun command SpeedrunStyleBanker = 0 SpeedrunStyleFastrun = 1 SinkBoostFollowOrder = -1 // Follow the order SinkBoostFirst = 0 // First position SinkBoostLast = 1 // Last position // These are an int64 flaglist to construct the style of the contract ContractFlagNone = 0x0000 ContractFlagCrt = 0x0001 ContractFlagSelfRuns = 0x0002 ContractFlag6Tokens = 0x0100 ContractFlag8Tokens = 0x0200 ContractFlagDynamicTokens = 0x0400 ContractFlag4Tokens = 0x0800 ContractFlagFastrun = 0x4000 ContractFlagBanker = 0x8000 ContractStyleFastrun = ContractFlagFastrun ContractStyleFastrunBanker = ContractFlagBanker ContractPlaystyleUnset = 0 // Unset ContractPlaystyleChill = 1 // Chill ContractPlaystyleACOCooperative = 2 // ACO Cooperative ContractPlaystyleFastrun = 3 // Fastrun ContractPlaystyleLeaderboard = 4 // Leaderboard ContractPlaystyleGGRerun = 5 // GG Rerun )
Constnts for the contract
Variables ¶
var ( // Contracts is a map of contracts and is saved to disk Contracts map[string]*Contract // ContractsMutex is used to synchronize access to the Contracts map ContractsMutex sync.RWMutex )
var ( ErrNoChannelContract = errors.New("no contract found for channel") ErrEvaluationNotFound = errors.New("evaluation not found for contract") ErrCoopIDMissing = errors.New("coop id missing") ErrUnsupportedCXPVersion = errors.New("unsupported cxp version") ErrCoopStatusFetch = errors.New("coop status fetch failed") ErrCoopStatusResponse = errors.New("coop status error") ErrCoopNoGrade = errors.New("coop grade missing") ErrCoopNotFinished = errors.New("coop not finished") ErrContribProcess = errors.New("contributors processing failed") ErrInvalidContractID = errors.New("invalid contract id") ErrCoopGradeInvalid = errors.New("invalid coop grade index") ErrReportSendFailed = errors.New("report send failed") ErrContractDurationMismatch = errors.New("contract duration mismatch") )
ErrNoChannelContract is returned when no contract can be found for the specified channel. ErrEvaluationNotFound is returned when an expected evaluation for a contract cannot be found. ErrCoopIDMissing indicates that a required coop identifier was not provided. ErrUnsupportedCXPVersion indicates that the provided CXP protocol or API version is not supported. ErrCoopStatusFetch is returned when fetching the coop status from an external source fails. ErrCoopStatusResponse indicates that the coop status endpoint returned an error or invalid response. ErrCoopNoGrade is returned when no grade is available for the coop. ErrCoopNotFinished indicates that the coop has not yet reached a finished state. ErrContribProcess is returned when processing contributor information fails. ErrInvalidContractID indicates that the provided contract identifier is invalid or malformed. ErrCoopGradeInvalid is returned when the coop grade index is out of range or otherwise invalid. ErrReportSendFailed indicates that sending or publishing the report failed. ErrContractDurationMismatch is returned when the actual contract duration does not match the expected duration.
var ( DefaultLeggyTE = 100.0 DefaultLeggyDeflectorBonus = 0.20 DefaultLeggyMetronome = 1.35 DefaultLeggyCompass = 1.50 DefaultLeggyGusset = 1.25 DefaultLeggyDeliverySlots = 10.0 DefaultLeggyIHR = 7440.0 DefaultLeggyChalice = 1.40 DefaultLeggyMonocle = 1.30 DefaultLeggyIHRSlots = 8.0 DefaultLeggyChickenRunPercent = 70.0 )
var KevinLoc = func() *time.Location { loc, err := time.LoadLocation("America/Los_Angeles") if err != nil { return time.UTC } return loc }()
KevinLoc is the time.Location for America/Los_Angeles, falls back to UTC on error
Functions ¶
func AddBoostTokens ¶
func AddBoostTokens(s *discordgo.Session, i *discordgo.InteractionCreate, setCountWant int, countWantAdjust int) (int, int, error)
AddBoostTokens will add tokens to the current booster and adjust the count of the booster
func AddBoostTokensInteraction ¶
func AddBoostTokensInteraction(s *discordgo.Session, i *discordgo.InteractionCreate, setCountWant int, countWantAdjust int)
AddBoostTokensInteraction handles the interactions responses for AddBoostTokens
func AddContractMember ¶
func AddContractMember(s *discordgo.Session, guildID string, channelID string, operator string, mention string, guest string, order int, alreadyBoosted bool) error
AddContractMember adds a member to a contract
func AdminContractReport ¶
func AdminContractReport(s *discordgo.Session, i *discordgo.InteractionCreate, contract *Contract, targetChannelID string)
AdminContractReport sends a contract summary plus a JSON attachment containing
func ArchiveContracts ¶
ArchiveContracts will set a contract state to Archive if it is older than 5 days
func ChangeBoostOrder ¶
func ChangeBoostOrder(s *discordgo.Session, guildID string, channelID string, userID string, boostOrder string, redraw bool) (string, error)
ChangeBoostOrder will change the order of the boosters in the contract
func ChangeContractIDs ¶
func ChangeContractIDs(s *discordgo.Session, guildID string, channelID string, userID string, contractID string, coopID string, coordinatorID string) (int, error)
ChangeContractIDs will change the contractID and/or coopID
func ChangeCurrentBooster ¶
func ChangeCurrentBooster(s *discordgo.Session, guildID string, channelID string, userID string, newBooster string, redraw bool) error
ChangeCurrentBooster will change the current booster to the specified userID
func CheckCoopStatusPermission ¶
func CheckCoopStatusPermission(s *discordgo.Session, i *discordgo.InteractionCreate, coopStatusFixEnabled bool) bool
CheckCoopStatusPermission checks if a user needs permission for CoopStatus API calls Returns true if permission is valid or not needed, false if permission dialog is needed If permission is not valid, it shows the permission dialog and returns false
func CheckLeaderboardPermission ¶
func CheckLeaderboardPermission(s *discordgo.Session, i *discordgo.InteractionCreate) bool
CheckLeaderboardPermission checks if a user has granted permission for leaderboard API calls. Returns true if permission is valid, false if the permission dialog was shown.
func ContractReport ¶
func ContractReport( s *discordgo.Session, i *discordgo.InteractionCreate, optionMap map[string]*discordgo.ApplicationCommandInteractionDataOption, eiID string, okayToSave bool, ) error
ContractReport generates a contract report for player's contract with the given contract ID
Parameters:
- s: active Discord session
- i: the triggering interaction
- optionMap: slash-command options (e.g., "contract-id").
- userID: Discord user ID of the caller
- okayToSave: whether API fetches may be cached/persisted.
Returns:
- error: nil on success.
func CreatePredictedContract ¶
func CreatePredictedContract() []ei.EggIncContract
CreatePredictedContract creates one placeholder contract each for Monday, Wednesday, Friday, and Friday Ultra based on the next predicted release dates.
func DeleteContract ¶
DeleteContract will delete the contract
func DownloadCoopStatusStones ¶
func DownloadCoopStatusStones(contractID string, coopID string, details bool, soloName string, useBuffHistory bool, eeidOverride string) (string, string, []*discordgo.MessageEmbedField)
DownloadCoopStatusStones will download the coop status for a given contract and coop ID
func DrawBoostList ¶
func DrawBoostList(s *discordgo.Session, contract *Contract) []discordgo.MessageComponent
DrawBoostList will draw the boost list for the contract
func EncodeSandboxData ¶
func EncodeSandboxData(cxpToggle bool, targetEgg float64, tokenTimer string, contractLengthInSeconds int, numPlayers int, c *ei.EggIncContract, players []SandboxPlayer) (string, error)
EncodeSandboxData generates and encodes configuration data for the SR Sandbox v_5 format.
Parameters:
- CxpToggle (bool): enables or disables CXP calculations.
- TargetEgg (string): target egg count.
- TokenTimer (string): token timer interval in minutes.
- contractLengthInSeconds (int): total contract duration in seconds.
- numPlayers (int): coop size
- c (*ei.EggIncContract): pointer to the contract data.
- players ([]SandboxPlayer): array of player configurations to include.
Returns:
- (string): version-tagged encoded SR Sandbox data.
- (error): returned if encoding fails.
func FindEggEmoji ¶
FindEggEmoji will find the token emoji for the given guild
func FinishContract ¶
FinishContract is called only when the contract is complete
func FmtActiveModifier ¶
func FmtActiveModifier(c *ei.EggIncContract) (string, int)
FmtActiveModifier checks the contract modifiers in order and returns the first active one.
Parameters:
- c (*ei.EggIncContract): pointer to the contract data
Returns:
- string: formatted active modifier value (e.g., "1.05").
- int: index of the active modifier (0: HabCap, 1: IHR, 2: SR, 3: ELR).
func FmtNumberSingleUnit ¶
FmtNumberSingleUnit converts a float64 to a string with the correct unit scale. Parameters:
- v (float64): numeric value
- srSandboxOrdering (bool): optional flag to use SR sandbox ordering.
Returns:
- string: formatted number as a string
- int: unit index Normal: 0=Quintillion, 1=quadrillion, 2=Trillion SR Sandbox: 0=quadrillion, 1=Quintillion, 2=Trillion -1=none
func GenerateContractSandboxData ¶
func GenerateContractSandboxData(contract *Contract, players []SandboxPlayer) (string, error)
GenerateContractSandboxData builds an SR Sandbox query string from a Contract and player data. It does not require coop status data.
func GenerateContractSandboxDataWithOptions ¶
func GenerateContractSandboxDataWithOptions(contract *Contract, players []SandboxPlayer, options *ContractSandboxOptions) (string, error)
GenerateContractSandboxDataWithOptions builds an SR Sandbox query string from a Contract and player data, allowing callers to override derived values (for example, grade-specific coop status data).
func GenerateContractSandboxURL ¶
func GenerateContractSandboxURL(contract *Contract, players []SandboxPlayer) (string, error)
GenerateContractSandboxURL builds the full SR Sandbox URL from a Contract and player data.
func GenerateContractSandboxURLWithOptions ¶
func GenerateContractSandboxURLWithOptions(contract *Contract, players []SandboxPlayer, options *ContractSandboxOptions) (string, error)
GenerateContractSandboxURLWithOptions builds the full SR Sandbox URL from a Contract and player data, allowing callers to override derived values (for example, grade-specific coop status data).
func GetAvailabilityComponents ¶
func GetAvailabilityComponents(s *discordgo.Session, contract *Contract, userID string) []discordgo.MessageComponent
GetAvailabilityComponents returns the components for the availability command
func GetContractArchivesForNames ¶
func GetContractArchivesForNames(s *discordgo.Session, names []string, cxpVersion string, forceRefresh bool, okayToSave bool, ) (archives [][]*ei.LocalContract, fetched []bool, missing []string, err error)
GetContractArchivesForNames fetches contract archives for a list of player names concurrently, returning index-aligned slices for (archives, fetched, missing).
func GetContractDescription ¶
GetContractDescription gets the description for a contract identified by the channel ID.
func GetContractEstimateString ¶
func GetContractEstimateString(contractID string, includeLeggySet bool, teOverride ...float64) string
GetContractEstimateString returns a string with the estimated completion time of a contract
func GetEggStandardTime ¶
GetEggStandardTime returns 9:00 AM Pacific Time (PT) for the given date, accounting for daylight savings.
func GetHelp ¶
func GetHelp(s *discordgo.Session, guildID string, channelID string, userID string) *discordgo.MessageSend
GetHelp will return the help string for the contract
func GetPredCommand ¶
func GetPredCommand(cmd string) *discordgo.ApplicationCommand
GetPredCommand returns the /pred command definition.
func GetPredictedTimes ¶
GetPredictedTimes calculates and returns prediction times for all contracts and custom eggs.
func GetPredictionBrackets ¶
func GetPredictionBrackets() (wed, friPE, friUltra []ei.EggIncContract)
GetPredictionBrackets returns the sorted brackets for all Leggacy contracts.
func GetPredictionsCommand ¶
func GetPredictionsCommand(cmd string) *discordgo.ApplicationCommand
GetPredictionsCommand returns the command for the /predictions command
func GetRoleNamesForContract ¶
GetRoleNamesForContract returns role names for one contract without loading the full role map.
func GetSignupComponents ¶
func GetSignupComponents(contract *Contract) (string, []discordgo.MessageComponent)
GetSignupComponents returns the signup components for a contract
func GetSlashAdminContractsListCommand ¶
func GetSlashAdminContractsListCommand(cmd string) *discordgo.ApplicationCommand
GetSlashAdminContractsListCommand returns the command definition for admin contract list
func GetSlashAvailabilityCommand ¶
func GetSlashAvailabilityCommand(cmd string) *discordgo.ApplicationCommand
GetSlashAvailabilityCommand returns the slash command for setting availability
func GetSlashBoostCommand ¶
func GetSlashBoostCommand(cmd string) *discordgo.ApplicationCommand
GetSlashBoostCommand returns the command definition for boosting
func GetSlashBoostOrderCommand ¶
func GetSlashBoostOrderCommand(cmd string) *discordgo.ApplicationCommand
GetSlashBoostOrderCommand returns the definition of the /boost-order command.
func GetSlashBumpCRCommand ¶
func GetSlashBumpCRCommand(cmd string) *discordgo.ApplicationCommand
GetSlashBumpCRCommand returns the command definition for bumping CR messages
func GetSlashBumpCommand ¶
func GetSlashBumpCommand(cmd string) *discordgo.ApplicationCommand
GetSlashBumpCommand returns the command definition for bumping a contract
func GetSlashCalcContractTval ¶
func GetSlashCalcContractTval(cmd string) *discordgo.ApplicationCommand
GetSlashCalcContractTval calculates the callers token value of a running contract
func GetSlashChangeCommand ¶
func GetSlashChangeCommand(cmd string) *discordgo.ApplicationCommand
GetSlashChangeCommand returns the /update slash command with main subcommand groups for farmer and contract
func GetSlashChangeOneBoosterCommand ¶
func GetSlashChangeOneBoosterCommand(cmd string) *discordgo.ApplicationCommand
GetSlashChangeOneBoosterCommand adjust aspects of a running contract
func GetSlashChangePlannedStartCommand ¶
func GetSlashChangePlannedStartCommand(cmd string) *discordgo.ApplicationCommand
GetSlashChangePlannedStartCommand adjust aspects of a running contract
func GetSlashChangeSpeedRunSinkCommand ¶
func GetSlashChangeSpeedRunSinkCommand(cmd string) *discordgo.ApplicationCommand
GetSlashChangeSpeedRunSinkCommand returns the slash command for changing speedrun sink assignments
func GetSlashContractCommand ¶
func GetSlashContractCommand(cmd string) *discordgo.ApplicationCommand
GetSlashContractCommand returns the slash command for creating a contract
func GetSlashContractReportCommand ¶
func GetSlashContractReportCommand(cmd string) *discordgo.ApplicationCommand
GetSlashContractReportCommand returns the command for the /contract-report command
func GetSlashContractSettingsCommand ¶
func GetSlashContractSettingsCommand(cmd string) *discordgo.ApplicationCommand
GetSlashContractSettingsCommand returns the command definition for contract settings
func GetSlashCoopETACommand ¶
func GetSlashCoopETACommand(cmd string) *discordgo.ApplicationCommand
GetSlashCoopETACommand returns the command definition for the coopeta command
func GetSlashCoopTval ¶
func GetSlashCoopTval(cmd string) *discordgo.ApplicationCommand
GetSlashCoopTval calculates the coop token value of a running contract
func GetSlashCsEstimates ¶
func GetSlashCsEstimates(cmd string) *discordgo.ApplicationCommand
GetSlashCsEstimates returns the slash command for estimating scores
func GetSlashEstimateTime ¶
func GetSlashEstimateTime(cmd string) *discordgo.ApplicationCommand
GetSlashEstimateTime is the definition of the slash command
func GetSlashHelpCommand ¶
func GetSlashHelpCommand(cmd string) *discordgo.ApplicationCommand
GetSlashHelpCommand returns the command for the /help command
func GetSlashJoinContractCommand ¶
func GetSlashJoinContractCommand(cmd string) *discordgo.ApplicationCommand
GetSlashJoinContractCommand returns the command definition for joining a contract
func GetSlashLeaderboard ¶
func GetSlashLeaderboard(cmd string) *discordgo.ApplicationCommand
GetSlashLeaderboard returns the /leaderboard command
func GetSlashLinkAlternateCommand ¶
func GetSlashLinkAlternateCommand(cmd string) *discordgo.ApplicationCommand
GetSlashLinkAlternateCommand allows a player to associate an alt.
func GetSlashLobbyCommand ¶
func GetSlashLobbyCommand(cmd string) *discordgo.ApplicationCommand
GetSlashLobbyCommand returns the slash command for showing the current coop lobby.
func GetSlashPruneCommand ¶
func GetSlashPruneCommand(cmd string) *discordgo.ApplicationCommand
GetSlashPruneCommand returns the command definition for pruning a booster
func GetSlashRegisterAltCommand ¶
func GetSlashRegisterAltCommand(cmd string) *discordgo.ApplicationCommand
GetSlashRegisterAltCommand returns the /register-alt command
func GetSlashRegisterCommand ¶
func GetSlashRegisterCommand(cmd string) *discordgo.ApplicationCommand
GetSlashRegisterCommand returns the /register command
func GetSlashRenameThread ¶
func GetSlashRenameThread(cmd string) *discordgo.ApplicationCommand
GetSlashRenameThread is the definition of the slash command
func GetSlashRerunEvalCommand ¶
func GetSlashRerunEvalCommand(cmd string) *discordgo.ApplicationCommand
GetSlashRerunEvalCommand returns the command for the /launch-helper command
func GetSlashScoreExplorerCommand ¶
func GetSlashScoreExplorerCommand(cmd string) *discordgo.ApplicationCommand
GetSlashScoreExplorerCommand returns the slash command for token tracking
func GetSlashSkipCommand ¶
func GetSlashSkipCommand(cmd string) *discordgo.ApplicationCommand
GetSlashSkipCommand returns the command definition for skipping a booster
func GetSlashSpeedrunCommand ¶
func GetSlashSpeedrunCommand(cmd string) *discordgo.ApplicationCommand
GetSlashSpeedrunCommand returns the slash command for speedrun
func GetSlashStones ¶
func GetSlashStones(cmd string) *discordgo.ApplicationCommand
GetSlashStones will return the discord command for calculating ideal stone set
func GetSlashTeamworkEval ¶
func GetSlashTeamworkEval(cmd string) *discordgo.ApplicationCommand
GetSlashTeamworkEval will return the discord command for calculating token values of a running contract
func GetSlashToggleContractPingsCommand ¶
func GetSlashToggleContractPingsCommand(cmd string) *discordgo.ApplicationCommand
GetSlashToggleContractPingsCommand returns the command definition for toggling pings
func GetSlashTokenEditCommand ¶
func GetSlashTokenEditCommand(cmd string) *discordgo.ApplicationCommand
GetSlashTokenEditCommand returns the slash command for token tracking removal
func GetSlashUnboostCommand ¶
func GetSlashUnboostCommand(cmd string) *discordgo.ApplicationCommand
GetSlashUnboostCommand returns the command definition for unboosting
func GetSlashUpdateCommand ¶
func GetSlashUpdateCommand(cmd string) *discordgo.ApplicationCommand
GetSlashUpdateCommand returns the /update slash command with main subcommand groups for farmer and contract
func GetSlashUploadBannerCommand ¶
func GetSlashUploadBannerCommand(cmd string) *discordgo.ApplicationCommand
GetSlashUploadBannerCommand returns the command definition for uploading a custom banner
func GetSlashVirtueCommand ¶
func GetSlashVirtueCommand(cmd string) *discordgo.ApplicationCommand
GetSlashVirtueCommand returns the command for the /launch-helper command
func GetSlashVolunteerSink ¶
func GetSlashVolunteerSink(cmd string) *discordgo.ApplicationCommand
GetSlashVolunteerSink is used to volunteer as token sink for a contract
func GetSlashVoluntellSink ¶
func GetSlashVoluntellSink(cmd string) *discordgo.ApplicationCommand
GetSlashVoluntellSink is used to volunteer as token sink for a contract
func GetTargetBuffTimeValue ¶
GetTargetBuffTimeValue returns the target buff time value for a contract. Rules:
- If cxpVersion == ei.SeasonalScoringNerfed: target = durationSec * 1.875.
- Else: target = durationSec * 2.0.
func GetTargetTval ¶
GetTargetTval will return the target tval for the contract based on the contract duration and minutes per token
func GetThematicComplaintsForContract ¶
GetThematicComplaintsForContract returns complaints for one contract without loading the full complaint map.
func HandleActiveContractsPage ¶
func HandleActiveContractsPage(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleActiveContractsPage handles button interactions for the active-contracts message.
func HandleAdminContractList ¶
func HandleAdminContractList(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminContractList will list all contracts.
func HandleAdminContractListComponent ¶
func HandleAdminContractListComponent(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminContractListComponent handles all button/select interactions for admin-contract-list.
func HandleAdminCurrentContracts ¶
func HandleAdminCurrentContracts(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminCurrentContracts handles the admin current-contracts command.
func HandleAdminExitButton ¶
func HandleAdminExitButton(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminExitButton handles the admin-exit button clicks (confirm, cancel, and page navigation).
func HandleAdminExitCommand ¶
func HandleAdminExitCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminExitCommand handles the admin-exit command to gracefully shutdown the bot.
func HandleAdminGetContractData ¶
func HandleAdminGetContractData(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminGetContractData get JSON data about a contract given the contract and coop id
func HandleAdminGuildStateAutoComplete ¶
func HandleAdminGuildStateAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminGuildStateAutoComplete serves guild-id suggestions from persisted guildstate keys.
func HandleAdminGuildStateCommand ¶
func HandleAdminGuildStateCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminGuildStateCommand routes to guildstate handlers with explicit guild override.
func HandleAdminListRoles ¶
func HandleAdminListRoles(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminListRoles is the handler for the list roles command
func HandleAdminMembers ¶
func HandleAdminMembers(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminMembers handles the set, remove, and list subcommands for admin-members.
func HandleAdminStatusMessageAutoComplete ¶
func HandleAdminStatusMessageAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminStatusMessageAutoComplete provides status message suggestions.
func HandleAdminStatusMessageCommand ¶
func HandleAdminStatusMessageCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAdminStatusMessageCommand sets a one-time status message override.
func HandleAllContractsAutoComplete ¶
func HandleAllContractsAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAllContractsAutoComplete will handle the contract auto complete of contract-id's default to new contracts but allow searching all contracts
func HandleAltsAutoComplete ¶
func HandleAltsAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAltsAutoComplete will populate with linked alternate names
func HandleArtifactAltAutoComplete ¶
func HandleArtifactAltAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleArtifactAltAutoComplete provides linked-alt suggestions for /artifact.
func HandleArtifactCommand ¶
func HandleArtifactCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleArtifactCommand handles the /artifacts command
func HandleArtifactReactions ¶
func HandleArtifactReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleArtifactReactions handles all the button reactions for a contract settings
func HandleAvailabilityCommand ¶
func HandleAvailabilityCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleAvailabilityCommand handles the /availability command
func HandleBoostCommand ¶
func HandleBoostCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleBoostCommand will handle the /boost command
func HandleBoostOrderCommand ¶
func HandleBoostOrderCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleBoostOrderCommand handles the /boost-order command, starting an interactive session to reorder the boost order for a contract.
func HandleBoostOrderReactions ¶
func HandleBoostOrderReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleBoostOrderReactions handles button interactions for the boost order catalyst, allowing the user to build a new boost order and save it.
func HandleBumpCRCommand ¶
func HandleBumpCRCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleBumpCRCommand will handle the /bump-cr command
func HandleBumpCommand ¶
func HandleBumpCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleBumpCommand will handle the /bump command
func HandleChangeCommand ¶
func HandleChangeCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleChangeCommand handles the /update slash command
func HandleChangeOneBoosterCommand ¶
func HandleChangeOneBoosterCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleChangeOneBoosterCommand will handle the /change-one-booster command
func HandleChangePlannedStartCommand ¶
func HandleChangePlannedStartCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleChangePlannedStartCommand will handle the /change--planned-start command
func HandleChangeSpeedrunSinkCommand ¶
func HandleChangeSpeedrunSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleChangeSpeedrunSinkCommand handles the change speedrun sink command
func HandleChartReactions ¶
func HandleChartReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleChartReactions handles button and select menu interactions for the chart view
func HandleContractAutoComplete ¶
func HandleContractAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractAutoComplete will handle the contract auto complete of contract-id's
func HandleContractCalcContractTvalCommand ¶
func HandleContractCalcContractTvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractCalcContractTvalCommand will handle the /contract-token-tval command
func HandleContractCommand ¶
func HandleContractCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractCommand will handle the /contract command
func HandleContractDelete ¶
func HandleContractDelete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractDelete facilitates the deletion of a channel contract
func HandleContractReactions ¶
func HandleContractReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractReactions handles all the button reactions for a contract
func HandleContractReport ¶
func HandleContractReport(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractReport handles the /contract-report command
func HandleContractSettingsCommand ¶
func HandleContractSettingsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractSettingsCommand will handle the /contract-settings command
func HandleContractSettingsReactions ¶
func HandleContractSettingsReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleContractSettingsReactions handles all the button reactions for a contract settings
func HandleCoopAutoComplete ¶
func HandleCoopAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleCoopAutoComplete will handle the contract auto complete of contract-id's
func HandleCoopETACommand ¶
func HandleCoopETACommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleCoopETACommand will handle the /coopeta command
func HandleCoopStatusPermissionButton ¶
func HandleCoopStatusPermissionButton(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleCoopStatusPermissionButton handles button interactions for the permission dialog
func HandleCoopTvalCommand ¶
func HandleCoopTvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleCoopTvalCommand will handle the /contract-token-tval command
func HandleCsEstimateButtons ¶
func HandleCsEstimateButtons(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleCsEstimateButtons handles button interactions for /cs-estimate
func HandleCsEstimatesCommand ¶
func HandleCsEstimatesCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleCsEstimatesCommand handles the estimate scores command
func HandleEggIDModalSubmit ¶
func HandleEggIDModalSubmit(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleEggIDModalSubmit handles the modal submission for an egginc ID
func HandleEstimateTimeCommand ¶
func HandleEstimateTimeCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleEstimateTimeCommand will handle the estimate-contract-time command
func HandleHelpCommand ¶
func HandleHelpCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleHelpCommand will handle the help command
func HandleJoinCommand ¶
func HandleJoinCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleJoinCommand will handle the /join command
func HandleLeaderboard ¶
func HandleLeaderboard(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLeaderboard handles the /leaderboard command
func HandleLeaderboardAutoComplete ¶
func HandleLeaderboardAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLeaderboardAutoComplete provides typed season suggestions for /leaderboard.
func HandleLeaderboardPage ¶
func HandleLeaderboardPage(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLeaderboardPage handles the season select menu, refresh, and close button interactions
func HandleLeaderboardPermissionButton ¶
func HandleLeaderboardPermissionButton(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLeaderboardPermissionButton handles button interactions for the leaderboard permission dialog.
func HandleLinkAlternateAutoComplete ¶
func HandleLinkAlternateAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLinkAlternateAutoComplete will handle the /link-alternate autocomplete
func HandleLinkAlternateCommand ¶
func HandleLinkAlternateCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLinkAlternateCommand will handle the /link-alternate command
func HandleLobbyButtons ¶
func HandleLobbyButtons(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLobbyButtons handles refresh and close button interactions for /lobby.
func HandleLobbyCommand ¶
func HandleLobbyCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleLobbyCommand handles the /lobby slash command.
func HandleMenuReactions ¶
func HandleMenuReactions(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleMenuReactions handles the menu reactions for the contract
func HandlePredCommand ¶
func HandlePredCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandlePredCommand dispatches /pred subcommands.
func HandlePredPage ¶
func HandlePredPage(s *discordgo.Session, i *discordgo.InteractionCreate)
HandlePredPage handles select menu and button interactions for /pred.
func HandlePredictionsCommand ¶
func HandlePredictionsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandlePredictionsCommand will handle the /predictions command
func HandlePredictionsPage ¶
func HandlePredictionsPage(s *discordgo.Session, i *discordgo.InteractionCreate)
HandlePredictionsPage handles interaction for prediction pages
func HandlePruneCommand ¶
func HandlePruneCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandlePruneCommand will handle the /prune command
func HandleRegister ¶
func HandleRegister(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleRegister handles the /register command
func HandleRegisterAlt ¶
func HandleRegisterAlt(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleRegisterAlt handles the /register-alt command
func HandleRegisterAltAutocomplete ¶
func HandleRegisterAltAutocomplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleRegisterAltAutocomplete handles the autocomplete for the /register-alt command
func HandleRenameThreadCommand ¶
func HandleRenameThreadCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleRenameThreadCommand will handle the thread rename command
func HandleReplayEval ¶
func HandleReplayEval(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleReplayEval handles the /replay-eval command
func HandleRestartContract ¶
func HandleRestartContract(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleRestartContract recycles the current contract and recreates it with the same participants, planned start time, and run style.
func HandleScoreExplorerCommand ¶
func HandleScoreExplorerCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleScoreExplorerCommand will handle the /playground command
func HandleScoreExplorerPage ¶
func HandleScoreExplorerPage(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleScoreExplorerPage steps a page of cached teamwork data
func HandleSignupBell ¶
func HandleSignupBell(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSignupBell handles the interaction for joining a contract with a bell
func HandleSignupFarmer ¶
func HandleSignupFarmer(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSignupFarmer handles the interaction for joining a contract as a farmer
func HandleSignupLeave ¶
func HandleSignupLeave(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSignupLeave handles the interaction for leaving a contract
func HandleSignupStart ¶
func HandleSignupStart(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSignupStart handles the interaction for starting the signup process
func HandleSkipCommand ¶
func HandleSkipCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSkipCommand will handle the /skip command
func HandleSlashVolunteerSinkCommand ¶
func HandleSlashVolunteerSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSlashVolunteerSinkCommand is used to volunteer as token sink for a contract
func HandleSlashVoluntellSinkCommand ¶
func HandleSlashVoluntellSinkCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSlashVoluntellSinkCommand is used to volunteer as token sink for a contract
func HandleSpeedrunCommand ¶
func HandleSpeedrunCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleSpeedrunCommand handles the speedrun command
func HandleStonesCommand ¶
func HandleStonesCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleStonesCommand will handle the /stones command
func HandleStonesPage ¶
func HandleStonesPage(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleStonesPage steps a page of cached stones data
func HandleTeamworkEvalCommand ¶
func HandleTeamworkEvalCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleTeamworkEvalCommand will handle the /teamwork command
func HandleTeamworkPage ¶
func HandleTeamworkPage(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleTeamworkPage steps a page of cached teamwork data
func HandleToggleContractPingsCommand ¶
func HandleToggleContractPingsCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleToggleContractPingsCommand will handle the /toggle-contract-pings command
func HandleTokenEditAutoComplete ¶
func HandleTokenEditAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleTokenEditAutoComplete will handle the /token-edit autocomplete
func HandleTokenEditCommand ¶
func HandleTokenEditCommand(s *discordgo.Session, i *discordgo.InteractionCreate) string
HandleTokenEditCommand will handle the /token-edit command
func HandleTokenEditInteraction ¶
func HandleTokenEditInteraction(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleTokenEditInteraction handles the /token-edit command interaction
func HandleTokenIDAutoComplete ¶
func HandleTokenIDAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate) (string, []*discordgo.ApplicationCommandOptionChoice)
HandleTokenIDAutoComplete will handle the /token-edit token-id autocomplete
func HandleTokenListAutoComplete ¶
func HandleTokenListAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate) (string, []*discordgo.ApplicationCommandOptionChoice)
HandleTokenListAutoComplete will handle the /token-remove autocomplete
func HandleTokenReceiverAutoComplete ¶
func HandleTokenReceiverAutoComplete(s *discordgo.Session, i *discordgo.InteractionCreate) (string, []*discordgo.ApplicationCommandOptionChoice)
HandleTokenReceiverAutoComplete will handle the /token-edit new-receiver autocomplete
func HandleUnboostCommand ¶
func HandleUnboostCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleUnboostCommand will handle the /unboost command
func HandleUpdateCommand ¶
func HandleUpdateCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleUpdateCommand handles the /update slash command
func HandleUploadBannerCommand ¶
func HandleUploadBannerCommand(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleUploadBannerCommand handles the /upload-banner command
func HandleVirtue ¶
func HandleVirtue(s *discordgo.Session, i *discordgo.InteractionCreate)
HandleVirtue handles the /virtue command
func IsRoleCreatedByBot ¶
IsRoleCreatedByBot checks if a role name was created by the bot by verifying if it matches one of the role names from the bot's source lists (randomThingNames or contract team names)
func IsUserCreatorOfAnyContract ¶
IsUserCreatorOfAnyContract will return true if the user is the creator of any contract
func JoinContract ¶
func JoinContract(s *discordgo.Session, guildID string, channelID string, userID string, bell bool) error
JoinContract will add a user to the contract
func LoadContractData ¶
func LoadContractData(filename string)
LoadContractData will load contract data from a file
func LoadEggscapeCoopIDs ¶
func LoadEggscapeCoopIDs(filename string)
LoadEggscapeCoopIDs loads the eggscape coop ID list from a JSON file.
func LoadRoleNames ¶
LoadRoleNames loads all contract roles from the database
func LoadThematicComplaints ¶
LoadThematicComplaints loads all contract complaints from the database, using an in-memory cache to match previous behavior.
func MoveBooster ¶
func MoveBooster(s *discordgo.Session, guildID string, channelID string, userID string, boosterName string, boosterPosition int, redraw bool) error
MoveBooster will move a booster to a new position in the contract
func PopulateContractFromProto ¶
func PopulateContractFromProto(contractProtoBuf *ei.Contract) ei.EggIncContract
PopulateContractFromProto will populate a contract from a protobuf
func PopulateThematicComplaintsForContractID ¶
PopulateThematicComplaintsForContractID updates active contracts for a contract ID with complaints.
func PrevContractScoresFromArchives ¶
func PrevContractScoresFromArchives(archives [][]*ei.LocalContract, fetched []bool, contractID, currentCoopID string) (prev []float64, foundPrev []bool)
PrevContractScoresFromArchives returns previous contract scores for players whose archives were fetched.
func ReactionAdd ¶
func ReactionAdd(s *discordgo.Session, r *discordgo.MessageReaction) string
ReactionAdd is called when a reaction is added to a message
func ReactionRemove ¶
func ReactionRemove(s *discordgo.Session, r *discordgo.MessageReaction)
ReactionRemove handles a user removing a reaction from a message
func RedrawBoostList ¶
RedrawBoostList will move the boost message to the bottom of the channel
func RefreshGuildContractsForBannerUpdate ¶
RefreshGuildContractsForBannerUpdate updates banner URLs and redraws boost lists for active contracts associated with the given guild.
func Register ¶
func Register(s *discordgo.Session, i *discordgo.InteractionCreate, encryptedID string, okayToSave bool)
Register processes the register modal submission, saves the EI ID, and pulls a backup to update the player's IGN.
func RegisterAlt ¶
func RegisterAlt(s *discordgo.Session, i *discordgo.InteractionCreate, targetAlt string, encryptedID string)
RegisterAlt processes the register-alt modal submission.
func RemoveAddedReaction ¶
func RemoveAddedReaction(s *discordgo.Session, r *discordgo.MessageReaction)
RemoveAddedReaction removes an added reaction from a message so it can be reactivated
func RemoveFarmerByMention ¶
func RemoveFarmerByMention(s *discordgo.Session, guildID string, channelID string, operator string, mention string) error
RemoveFarmerByMention will remove a booster from the contract by mention
func RenderScoreTableANSI ¶
RenderScoreTableANSI renders the score table in an ANSI code block, highlighting the max value in each column. If includeDiff is true, includes the Diff column.
func RequestEggIncIDModal ¶
func RequestEggIncIDModal(s *discordgo.Session, i *discordgo.InteractionCreate, action string, optionMap map[string]*discordgo.ApplicationCommandInteractionDataOption)
RequestEggIncIDModal sends a modal to the user requesting their Egg Inc ID
func RerunEval ¶
func RerunEval(s *discordgo.Session, i *discordgo.InteractionCreate, optionMap map[string]*discordgo.ApplicationCommandInteractionDataOption, eiID string, okayToSave bool)
RerunEval evaluates the contract history and provides replay guidance
func SaveRoleNames ¶
SaveRoleNames saves contract roles to the database. It deletes existing roles for the given contract IDs and inserts the new ones in a transaction.
func SaveThematicComplaints ¶
SaveThematicComplaints saves contract complaints to the database. It deletes existing complaints for the given contract IDs and inserts the new ones in a transaction.
func SendSandboxDM ¶
SendSandboxDM builds and sends an SR Sandbox DM to a user.
func SetListMessageID ¶
SetListMessageID will save the list messageID for the contract
func SetReactionID ¶
SetReactionID will save the reactionID for the contract
func ShowCoopStatusPermissionDialog ¶
func ShowCoopStatusPermissionDialog(s *discordgo.Session, i *discordgo.InteractionCreate)
ShowCoopStatusPermissionDialog shows the ephemeral dialog with Allow and Close buttons
func ShowLeaderboardPermissionDialog ¶
func ShowLeaderboardPermissionDialog(s *discordgo.Session, i *discordgo.InteractionCreate)
ShowLeaderboardPermissionDialog shows the ephemeral dialog with Allow and Close buttons.
func SkipBooster ¶
SkipBooster will skip the current booster and move to the next
func SlashAdminCurrentContracts ¶
func SlashAdminCurrentContracts(cmd string) *discordgo.ApplicationCommand
SlashAdminCurrentContracts creates the admin current-contracts command for Discord.
func SlashAdminExitCommand ¶
func SlashAdminExitCommand(cmd string) *discordgo.ApplicationCommand
SlashAdminExitCommand provides an admin-only command to gracefully exit the bot.
func SlashAdminGetContractData ¶
func SlashAdminGetContractData(cmd string) *discordgo.ApplicationCommand
SlashAdminGetContractData is the slash to get contract JSON data
func SlashAdminGuildStateCommand ¶
func SlashAdminGuildStateCommand(cmd string) *discordgo.ApplicationCommand
SlashAdminGuildStateCommand provides a generic entrypoint for guildstate admin actions.
func SlashAdminListRoles ¶
func SlashAdminListRoles(cmd string) *discordgo.ApplicationCommand
SlashAdminListRoles is the slash to info about bot roles
func SlashAdminMembers ¶
func SlashAdminMembers(cmd string) *discordgo.ApplicationCommand
SlashAdminMembers returns the admin-members slash command definition with set/remove subcommands.
func SlashAdminStatusMessageCommand ¶
func SlashAdminStatusMessageCommand(cmd string) *discordgo.ApplicationCommand
SlashAdminStatusMessageCommand sets the next bot status message.
func SlashArtifactsCommand ¶
func SlashArtifactsCommand(cmd string) *discordgo.ApplicationCommand
SlashArtifactsCommand creates a new slash command for setting Egg, Inc name
func StartContractBoosting ¶
func StartContractBoosting(s *discordgo.Session, guildID string, channelID string, userID string) error
StartContractBoosting will start the contract
func UpdateAllContractsEggInfo ¶
func UpdateAllContractsEggInfo()
UpdateAllContractsEggInfo updates the EggName and EggEmoji fields for all active contracts, and regenerates banners if necessary.
func UpdateBannerURL ¶
func UpdateBannerURL(contract *Contract)
UpdateBannerURL will construct and set the BannerURL for the contract
func UpdateContractTime ¶
func UpdateContractTime(contractID string, coopID string, startTime, endTime time.Time, contractDurationSeconds float64)
UpdateContractTime will update the contract start time and estimated duration
func UpdatePredictedSignupContracts ¶
func UpdatePredictedSignupContracts(s *discordgo.Session, liveContracts []ei.EggIncContract) int
UpdatePredictedSignupContracts replaces signup contracts using predicted IDs with real IDs when a matching periodical contract for the same day/ultra slot arrives.
func UpdateThreadName ¶
UpdateThreadName will update a threads name to the current contract state
func UserInContract ¶
UserInContract will return true if the user is in the contract, also checks for any discrepancies between Boosters and Order and resolves them
Types ¶
type ArtifactSet ¶
ArtifactSet holds the data for each set of artifacts
type BankerInfo ¶
type BankerInfo struct {
CurrentBanker string // Current Banker
BoostingSinkUserID string // Boosting Sink User ID
PostSinkUserID string // Sink End of Contract User ID
SinkBoostPosition int // Sink Boost Position
}
BankerInfo holds information about contract Banker
type Bookmark ¶
type Bookmark struct {
ChannelID string `json:"channel_id"`
GuildID string `json:"guild_id,omitempty"`
GuildName string `json:"guild_name,omitempty"`
ChannelName string `json:"channel_name,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
Bookmark represents a bookmark for a specific channel in the dashboard
type Booster ¶
type Booster struct {
UserID string // Egg Farmer
GlobalName string
UserName string
ChannelName string
GuildID string // Discord Guild where this User is From
GuildName string
Ping bool // True/False
Register time.Time //o Time Farmer registered to boost
Name string
Unique string
Nick string
Mention string // String which mentions user
Color int
Alts []string // Array of alternate ids for the user
AltController string // User ID of the controller of this alternate
BoostState int // Indicates if current booster
TokensReceived int // indicate number of boost tokens
TokensWanted int // indicate number of boost tokens
TokenValue float64 // Current Token Value
TokenRequestFlag bool // Flag to indicate if the token request is active
StartTime time.Time // Time Farmer started boost turn
EndTime time.Time // Time Farmer ended boost turn
Duration time.Duration // Duration of boost
BoostingTokenTimestamp time.Time // When the boosting token was last received
VotingList []string // Record list of those that voted to boost
RunChickensTime time.Time // Time Farmer triggered chicken run reaction
RanChickensOn []string // Array of users that the farmer ran chickens on
BoostTriggerTime time.Time // Used for time remaining in boost
Hint []string // Used to track which hints have been given
ArtifactSet ArtifactSet // Set of artifacts for this booster
EstDurationOfBoost time.Duration // Estimated duration of the boost
EstEndOfBoost time.Time // Estimated end of the boost
EstRequestChickenRuns time.Time // Estimated time to request chicken runs
Ultra bool // Does this player have Ultra
TECount int // Truth Egg Count
Availability ContractAvailability // Availability for contracts
}
Booster holds the data for each booster within a Contract
type CompMap ¶
type CompMap struct {
Emoji string
ID string
Name string
Style discordgo.ButtonStyle
CustomID string
ComponentEmoji *discordgo.ComponentEmoji
}
CompMap is a cached set of components for this contract
type Contract ¶
type Contract struct {
ContractHash string // ContractID-CoopID
Location []*LocationData
CreatorID []string // Slice of creators
BannerURL string // URL for the contract banner
ContractID string // Contract ID
CoopID string // CoopID
PredictionSignup bool // True if this contract is/was a prediction
PredictionsList []string // List of predictions for this contract
PredictionInfo []PredictionInfo // Cached info for predictions
SeasonalScoring int // 1 = new scoring
Name string
Description string
Egg int32
EggName string
EggEmoji string
TokenStr string // Emoji for Token
ChickenRuns int // Number of Chicken Runs for this contract
ChickenRunCooldownMinutes int
MinutesPerToken int
EstimatedDuration time.Duration
CompletionDuration time.Duration
EstimatedEndTime time.Time
EstimatedDurationValid bool
ThreadName string
ThreadRenameTime time.Time
EstimateUpdateTime time.Time
TimeBoosting time.Time // When the contract boost started
CoopSize int
Ultra bool
UltraCount int
Style int64 // Mask for the Contract Style
PlayStyle int // Playstyle of the contract
NewToPlayStyle bool // Someone in the contract is new to this playstyle
LengthInSeconds int
BoostOrder int // How the contract is sorted
BoostVoting int
CurrentBoosterUserID string // Current booster UserID (source of truth)
BoostPosition int // Starting Slot
State int // Boost Completed
StartTime time.Time // When Contract is started
EndTime time.Time // When final booster ends
PlannedStartTime time.Time // Parameter start time
ActualStartTime time.Time // Actual start time for token tracking
ValidFrom time.Time // Base time used for offsets (9 AM PT of creation day)
RegisteredNum int
Boosters map[string]*Booster // Boosters Registered
CRMessageIDs map[string]string // CR reqest messageIDs
WaitlistBoosters []string // Waitlist of UserID's
Order []string
BoostedOrder []string // Actual order of boosting
OrderRevision int // Incremented when Order is changed
Banker BankerInfo // Banker for the contract
TokenLog []ei.TokenUnitLog
TokensPerMinute float64
CalcOperations int
CalcOperationTime time.Time
CoopTokenValueMsgID string
LastWishPrompt string // saved prompt for this contract
LastInteractionTime time.Time // last time the contract was drawn
HelpGuidanceUntil time.Time // Show bottom guidance while now is before this timestamp
NewFeature int // Used to slide in new features
DynamicData *DynamicTokenData
LastSaveTime time.Time // The last time the contract was saved
ThematicComplaints []string `json:"thematic_complaints,omitempty"`
// contains filtered or unexported fields
}
Contract is the main struct for each contract
func CreateContract ¶
func CreateContract(s *discordgo.Session, contractID string, coopID string, playStyle int, coopSize int, BoostOrder int, guildID string, channelID string, progenitors []string, userID string, plannedStartTime time.Time, validFrom time.Time) (*Contract, error)
CreateContract creates a new contract or joins an existing contract if run from a different location
func FindContract ¶
FindContract will find the contract by the guildID and channelID
func FindContractByHash ¶
FindContractByHash will find a contract by its hash
func FindContractByIDs ¶
FindContractByIDs will find the contract by the contractID and coopID
func FindContractByMessageID ¶
FindContractByMessageID will find the contract by the messageID
func (*Contract) UnmarshalJSON ¶
UnmarshalJSON handles backward compatibility for CRMessageIDs which used to be stored as an array but is now a map[string]string
type ContractAvailability ¶
type ContractAvailability struct {
Contract []string // list of contractIDs they want to run
Timeslots []string // list of timeslots they are available for, in the format "Monday 9-11am PT"
}
ContractAvailability holds the data for a user's availability for a contract
type ContractComplaint ¶
type ContractDatum ¶
type ContractDatum struct {
Channelid string
Contractid string
Coopid string
Value sql.NullString
}
type ContractDurationEstimate ¶
type ContractDurationEstimate struct {
Upper time.Duration
Lower time.Duration
Max time.Duration
SIAB time.Duration
MaxGG time.Duration
SIABGG time.Duration
SIABCompass bool
SIABGGCompass bool
MaxCompass bool
MaxGGCompass bool
UpperCompass bool
LowerCompass bool
}
ContractDurationEstimate groups the various duration estimates produced by getContractDurationEstimate.
type ContractRole ¶
type ContractSandboxOptions ¶
type ContractSandboxOptions struct {
TargetEggOverride *float64
TokenTimerMinutesOverride *int
ContractLengthSecondsOverride *int
CxpToggleOverride *bool
}
ContractSandboxOptions allows callers to override derived values when generating sandbox data from a Contract.
type ContractScore ¶
type ContractScore struct {
// contains filtered or unexported fields
}
ContractScore holds all the relevant information for calculating and displaying contract scores for contracts
func DownloadCoopStatusTeamwork ¶
func DownloadCoopStatusTeamwork(contractID string, coopID string, setContractEstimate bool, eeidOverride string) (string, map[string][]TeamworkOutputData, ContractScore)
DownloadCoopStatusTeamwork will download the coop status for a given contract and coop ID
type DeliveryTimeValue ¶
type DeliveryTimeValue struct {
// contains filtered or unexported fields
}
DeliveryTimeValue is a struct to hold the values for a delivery time
type DynamicTokenData ¶
type DynamicTokenData struct {
TokenTimer int
TE int64
HabNumber int64
OfflineIHR int64
Name string
ELR float64
TokenBoost [13]float64
BoostTimeMinutes [13]float64
ChickenRunTimeMinutes [13]float64
IhrBase int64
FourHabsOffline int64
MaxHab float64
ChickenRunHab float64
IHRMultiplier float64
ColleggtibleIHR float64
}
DynamicTokenData is a struct that holds the data needed to calculate dynamic tokens
type ExternalContractBookmark ¶
type ExternalContractBookmark struct {
ContractID string `json:"contract_id"`
CoopID string `json:"coop_id"`
ChannelID string `json:"channel_id"`
GuildID string `json:"guild_id,omitempty"`
GuildName string `json:"guild_name,omitempty"`
ChannelName string `json:"channel_name,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
ExternalContractBookmark represents a bookmark for an external contract
type GetActiveContractsRow ¶
type GetActiveContractsRow struct {
Contracthash interface{}
Value sql.NullString
}
type InsertContractParams ¶
type InsertContractParams struct {
Channelid string
Contractid string
Coopid string
Value sql.NullString
}
type LocationData ¶
type LocationData struct {
GuildID string
GuildName string
ChannelID string // Contract Discord ThreadID
ChannelMention string // Mention string for the thread
GuildContractRole discordgo.Role
RoleManagedByBot bool // True when the contract role name/role is created or managed by the bot
RoleMention string
ListMsgID string // Message ID for the Last Boost Order message
ReactionID string // Message ID for the reaction Order String
MessageIDs []string // Array of message IDs for any contract message
TokenXStr string // Emoji for Token
TokenXReactionStr string // Emoji for Token Reaction
}
LocationData holds server specific Data for a contract
type ParsedFarmer ¶
ParsedFarmer holds the categorized input for a farmer being added to a contract
func ParseFarmerInput ¶
func ParseFarmerInput(farmerInput string) []ParsedFarmer
ParseFarmerInput splits and categorizes a comma-separated string of farmers
type PlayerScoreParameters ¶
type PlayerScoreParameters struct {
// contains filtered or unexported fields
}
PlayerScoreParameters holds player specific parameters for calculating scores
type PredictionInfo ¶
PredictionInfo holds cached data for predicted contracts
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CountContractsByChannel ¶
func (*Queries) DeleteAllContractComplaints ¶
func (*Queries) DeleteAllContractRoles ¶
func (*Queries) DeleteContractByChannel ¶
func (*Queries) DeleteContractComplaints ¶
func (*Queries) DeleteContractRoles ¶
func (*Queries) GetActiveContracts ¶
func (q *Queries) GetActiveContracts(ctx context.Context) ([]GetActiveContractsRow, error)
func (*Queries) GetContractByChannelID ¶
func (*Queries) GetContractComplaints ¶
func (q *Queries) GetContractComplaints(ctx context.Context) ([]ContractComplaint, error)
func (*Queries) GetContractRoles ¶
func (q *Queries) GetContractRoles(ctx context.Context) ([]ContractRole, error)
func (*Queries) InsertContract ¶
func (q *Queries) InsertContract(ctx context.Context, arg InsertContractParams) error
func (*Queries) InsertContractComplaint ¶
func (q *Queries) InsertContractComplaint(ctx context.Context, arg InsertContractComplaintParams) error
func (*Queries) InsertContractRole ¶
func (q *Queries) InsertContractRole(ctx context.Context, arg InsertContractRoleParams) error
func (*Queries) UpdateContract ¶
func (*Queries) UpdateContractCoopID ¶
func (q *Queries) UpdateContractCoopID(ctx context.Context, arg UpdateContractCoopIDParams) error
func (*Queries) UpdateContractState ¶
func (q *Queries) UpdateContractState(ctx context.Context, arg UpdateContractStateParams) error
type SandboxPlayer ¶
type SandboxPlayer struct {
Name string // Player name
Tokens string // Player tokens used
TE string // Truth Egg (TE) count
Mirror bool // True if mirror (+1 token)
Colleggtible bool // True if player has all collectibles
Sink bool // True if sink (no tval)
Creator bool // True if creator (no join delay)
Item1 string // Item slot 1
Item2 string // Item slot 2
Item3 string // Item slot 3
Item4 string // Item slot 4
Item5 string // Item slot 5
Item6 string // Item slot 6
Item7 string // Item slot 7
Item8 string // Item slot 8
}
SandboxPlayer stores player-related data.
type ScoreCalcParams ¶
type ScoreCalcParams struct {
Grade ei.Contract_PlayerGrade `json:"grade"`
Deflector float64 `json:"deflector"`
DeflectorDownMinutes int `json:"deflector_down_minutes"`
Siab float64 `json:"siab"`
SiabMinutes int `json:"siab_minutes"`
Style int `json:"style"`
PlayStyleValues []float64 `json:"play_style_values"`
ChickenRuns int
SiabTimes []int `json:"siab_times"`
SiabIndex int `json:"siab_index"`
DeflIndex int `json:"defl_index"`
// contains filtered or unexported fields
}
ScoreCalcParams is the parameters for the score calculator
type TeamworkOutputData ¶
TeamworkOutputData is a struct to hold the output data for teamwork fields
type TokenUnit ¶
type TokenUnit struct {
Time time.Time // Time token was received
Value float64 // Last calculated value of the token
UserID string // Who sent or received the token
Serial string // Serial number of the token
}
TokenUnit holds the data for each token
type UpdateContractParams ¶
type UpdateContractParams struct {
Value sql.NullString
Channelid string
Contractid string
Coopid string
}
Source Files
¶
- admin_contract_list.go
- artifacts.go
- availability.go
- boost.go
- boost_admin.go
- boost_autocomplete.go
- boost_button_reactions.go
- boost_calctval.go
- boost_change.go
- boost_cooptval.go
- boost_datastore.go
- boost_draw.go
- boost_handlers.go
- boost_import.go
- boost_menu.go
- boost_order.go
- boost_reactions.go
- boost_sink.go
- boost_slashcmd.go
- boost_speedrun.go
- boost_track.go
- boost_wish.go
- contract.go
- contract_active.go
- contract_report.go
- contract_sandbox.go
- contract_scores.go
- coop_status_permission.go
- db.go
- dynamictokens.go
- eggidmodal.go
- estimate_scores.go
- estimate_time.go
- help.go
- leaderboard.go
- leaderboard_permission.go
- lobby.go
- mention.go
- message_redraw.go
- models.go
- predictions.go
- predictions_embeded.go
- query.sql.go
- register.go
- rerun-active.go
- rerun-chart.go
- rerun.go
- roles.go
- score_explorer.go
- sr_sandbox.go
- state_banker.go
- stones.go
- stones_pages.go
- teamwork.go
- teamwork_pages.go
- thread.go
- types.go
- update_change.go
- update_farmer.go
- virtue.go