boost

package
v0.0.0-...-01bb1d1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Unlicense Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RolePriorityMain   = 1
	RolePriorityHelper = 2
)
View Source
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
)
View Source
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
)
View Source
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.
	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
	ContractOrderIHR       = 11 // IHR based order
	ContractOrderIHRFuzzy  = 12 // Fuzzy IHR based order
	ContractOrderCustom    = 13 // Custom boost order using comparison language

	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
	ContractFlagThresholdTokens = 0x1000
	ContractFlagFastrun         = 0x4000
	ContractFlagBanker          = 0x8000
	ContractFlagAMQP            = 0x20000

	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

View Source
const ThreadRenameCooldown = 3 * time.Minute

ThreadRenameCooldown is the cooldown between Discord thread/channel renames (Discord limits PATCH /channels to 2 per 10m).

Variables

View Source
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
)
View Source
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.

View Source
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
)
View Source
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(client dc.Client, e dc.InteractionEvent, 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(client dc.Client, e *dc.ComponentEvent, setCountWant int, countWantAdjust int)

AddBoostTokensInteraction handles the interactions responses for AddBoostTokens

func AddBoostersToThread

func AddBoostersToThread(client dc.Client, contract *Contract)

AddBoostersToThread adds all contract boosters and creators to the contract thread(s) when the contract is not in signup mode.

func AddContractMember

func AddContractMember(client dc.Client, guildID string, channelID string, operator string, mention string, guest string, order int, alreadyBoosted bool) error

AddContractMember adds a member to a contract

func AddThreadMemberDelayed

func AddThreadMemberDelayed(client dc.Client, contractHash string, channelID, userID string, delay time.Duration)

AddThreadMemberDelayed waits for manualAddThreadMemberDelay (or the specified delay) and checks if the farmer has already joined the thread. If not, it adds them.

func AdminContractReport

func AdminContractReport(client dc.Client, e *dc.ComponentEvent, contract *Contract, targetChannelID string)

AdminContractReport sends a contract summary plus a JSON attachment containing

func ArchiveContracts

func ArchiveContracts(client dc.Client)

ArchiveContracts will set a contract state to Archive if it is older than 5 days

func AutoUpdateThreadName

func AutoUpdateThreadName(client dc.Client, contract *Contract)

AutoUpdateThreadName will automatically update a thread's name to the current contract state. Prediction signups (except predicted past contracts) do not auto-rename the thread.

func Boosting

func Boosting(client dc.Client, guildID string, channelID string) error

Boosting will mark a as boosted and advance to the next in the list

func BuildBoostOrderPreviewMessage

func BuildBoostOrderPreviewMessage(contract *Contract) (dc.Message, error)

BuildBoostOrderPreviewMessage creates the boost order image preview message with Keep and Dismiss buttons.

func BuildCustomOrderMessage

func BuildCustomOrderMessage(contract *Contract, session *customOrderSession, status string) dc.Message

BuildCustomOrderMessage formats the preview catalyst message with table image and action buttons.

func BuildDefineCustomOrderMessage

func BuildDefineCustomOrderMessage(contract *Contract, tmpl CustomBoostOrderTemplate, sessionUUID string, status string, isSaved ...bool) dc.Message

BuildDefineCustomOrderMessage creates the ⚙️ report message with table image and action buttons.

func CalculateBoostTime

func CalculateBoostTime(te int, tokens int, tokenRate float64, sixTokBoostTime float64, artifactMult ...float64) float64

CalculateBoostTime calculates the total time in minutes for a specific token strategy. Parameters:

te: Tachyon Deflector / Enrichment level (e.g., 0, 1, 2...)
tokens: Number of tokens used (0 to 8)
tokenRate: Token generation rate (minutes per token, e.g., 13.0)
sixTokBoostTime: The nominal 6-token boost time parameter from the sheet (e.g., 20.0)
artifactMult: Optional artifact multiplier (chalice, monocle, life stones, etc.)

func CalculateIHRRateFromBackup

func CalculateIHRRateFromBackup(backup *ei.Backup, userID string) (float64, string)

func CalculateIHRRateFromDB

func CalculateIHRRateFromDB(userID string) (float64, string)

func ChangeBoostOrder

func ChangeBoostOrder(client dc.Client, 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(client dc.Client, 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(client dc.Client, guildID string, channelID string, userID string, newBooster string, redraw bool) error

ChangeCurrentBooster will change the current booster to the specified userID

func CheckAndNotifyAdminExitRestart

func CheckAndNotifyAdminExitRestart(client dc.Client)

CheckAndNotifyAdminExitRestart checks if the bot was restarted via /admin-exit and updates the original ephemeral message to notify that the bot is back online.

func CheckAndPublishAMQPBoosterChange

func CheckAndPublishAMQPBoosterChange(contract *Contract, userID string, nick string, event string)

CheckAndPublishAMQPBoosterChange publishes a booster join or remove event if contract has AMQP enabled.

func CheckAndPublishAMQPContractUpdate

func CheckAndPublishAMQPContractUpdate(contract *Contract)

CheckAndPublishAMQPContractUpdate publishes an update event if contract has AMQP enabled.

func CheckCoopStatusPermission

func CheckCoopStatusPermission(e *dc.CommandEvent, 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(e dc.InteractionEvent) 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(
	e dc.InteractionEvent,
	options dc.OptionValues,
	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
  • options: the 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

func DeleteContract(client dc.Client, guildID string, channelID string) (string, error)

DeleteContract will delete the contract

func DeleteGlobalCustomOrder

func DeleteGlobalCustomOrder(name string) bool

DeleteGlobalCustomOrder deletes a globally published custom boost order template by name. Returns true if found and removed.

func DeleteMissingContract

func DeleteMissingContract(contractID string) error

DeleteMissingContract removes a missing contract from the database.

func DeleteUserCustomOrder

func DeleteUserCustomOrder(userID string, name string) bool

DeleteUserCustomOrder deletes a custom boost order template for a user by name. Returns true if found and removed.

func DownloadCoopStatusStones

func DownloadCoopStatusStones(channelID string, contractID string, coopID string, details bool, soloName string, useBuffHistory bool, eeidOverride string) (string, string, []dc.EmbedField)

DownloadCoopStatusStones will download the coop status for a given contract and coop ID

func DrawBoostList

func DrawBoostList(contract *Contract) []dc.LayoutComponent

DrawBoostList will draw the boost list for the contract

func DrawBoostListCustom

func DrawBoostListCustom(contract *Contract, compact bool) []dc.LayoutComponent

DrawBoostListCustom will draw the boost list for the contract, optionally compacting early and late boosters

func DrawBoostListUncompacted

func DrawBoostListUncompacted(contract *Contract) []dc.LayoutComponent

DrawBoostListUncompacted will draw the full boost list message without early and late compaction

func DrawPureBoostList

func DrawPureBoostList(contract *Contract) []dc.LayoutComponent

DrawPureBoostList will draw only the pure boost list without headers, banners, compaction, or guidance

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

func FindEggEmoji(eggOrig string) string

FindEggEmoji will find the token emoji for the given guild

func FinishContract

func FinishContract(client dc.Client, contract *Contract)

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

func FmtNumberSingleUnit(v float64, srSandboxOrdering bool) (string, int)

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 GetAttributions

func GetAttributions() *dc.Embed

GetAttributions will return an embed listing attributions and acknowledgements.

func GetAvailabilityComponents

func GetAvailabilityComponents(client dc.Client, contract *Contract, userID string) []dc.LayoutComponent

GetAvailabilityComponents returns the components for the availability command

func GetBoostMultiplierForTokens

func GetBoostMultiplierForTokens(tokens float64) float64

GetBoostMultiplierForTokens returns the boost multiplier for a specific number of tokens.

func GetContractArchivesForNames

func GetContractArchivesForNames(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 GetContractBoostOrderLines

func GetContractBoostOrderLines(contract *Contract) []string

GetContractBoostOrderLines returns the condition lines representing a contract's current boost order.

func GetContractCustomOrderName

func GetContractCustomOrderName(contract *Contract) string

GetContractCustomOrderName returns the human-readable name of a contract's custom boost order.

func GetContractDescription

func GetContractDescription(channelID string) string

GetContractDescription gets the description for a contract identified by the channel ID.

func GetContractEstimateString

func GetContractEstimateString(contractID string, includeLeggySet bool, showGG bool, teOverride ...float64) string

GetContractEstimateString returns a string with the estimated completion time of a contract

func GetCustomBoostOrderDoc

func GetCustomBoostOrderDoc() []byte

GetCustomBoostOrderDoc retrieves the markdown documentation bytes for CustomBoostOrder.md.

func GetEggStandardTime

func GetEggStandardTime(t time.Time) time.Time

GetEggStandardTime returns 9:00 AM Pacific Time (PT) for the given date, accounting for daylight savings.

func GetHelp

func GetHelp(client dc.Client, guildID string, channelID string, userID string) *dc.Embed

GetHelp will return the help string for the contract

func GetPlayerBoostConfig

func GetPlayerBoostConfig(te float64, artifactMult ...float64) (tokens float64, multiplier float64)

GetPlayerBoostConfig returns the optimal number of tokens used for boost and the boost multiplier based on the player's Tachyon Deflector / Enrichment (TE) level and optional artifact multiplier.

func GetPredCommand

func GetPredCommand(cmd string) *dc.Command

GetPredCommand returns the /pred command definition.

func GetPredictedContractTimes

func GetPredictedContractTimes(contractID string) (time.Time, time.Time, time.Time)

GetPredictedContractTimes returns the prediction times for a given contract. It returns (wednesdayTime, nonUltraTime, ultraTime).

func GetPredictedTimes

func GetPredictedTimes() (map[string]time.Time, map[string]time.Time)

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) *dc.Command

GetPredictionsCommand returns the command for the /predictions command

func GetRoleNamesForContract

func GetRoleNamesForContract(contractID string) ([]string, error)

GetRoleNamesForContract returns role names for one contract without loading the full role map.

func GetSignupComponents

func GetSignupComponents(contract *Contract) (string, []dc.LayoutComponent)

GetSignupComponents returns the signup components for a contract

func GetSlashAdminContractsListCommand

func GetSlashAdminContractsListCommand(cmd string) *dc.Command

GetSlashAdminContractsListCommand returns the command definition for admin contract list

func GetSlashAvailabilityCommand

func GetSlashAvailabilityCommand(cmd string) *dc.Command

GetSlashAvailabilityCommand returns the slash command for setting availability

func GetSlashBoostCommand

func GetSlashBoostCommand(cmd string) *dc.Command

GetSlashBoostCommand returns the command definition for boosting

func GetSlashBoostOrderCommand

func GetSlashBoostOrderCommand(cmd string) *dc.Command

GetSlashBoostOrderCommand returns the definition of the /boost-order command.

func GetSlashBoostOrderHelpersCommand

func GetSlashBoostOrderHelpersCommand(cmd string) *dc.Command

GetSlashBoostOrderHelpersCommand returns the definition of the /boost-order-helpers command.

func GetSlashBumpCRCommand

func GetSlashBumpCRCommand(cmd string) *dc.Command

GetSlashBumpCRCommand returns the command definition for bumping CR messages

func GetSlashBumpCommand

func GetSlashBumpCommand(cmd string) *dc.Command

GetSlashBumpCommand returns the command definition for bumping a contract

func GetSlashCalcContractTval

func GetSlashCalcContractTval(cmd string) *dc.Command

GetSlashCalcContractTval calculates the callers token value of a running contract

func GetSlashChangeCommand

func GetSlashChangeCommand(cmd string) *dc.Command

GetSlashChangeCommand returns the /update slash command with main subcommand groups for farmer and contract

func GetSlashChangeOneBoosterCommand

func GetSlashChangeOneBoosterCommand(cmd string) *dc.Command

GetSlashChangeOneBoosterCommand adjust aspects of a running contract

func GetSlashChangePlannedStartCommand

func GetSlashChangePlannedStartCommand(cmd string) *dc.Command

GetSlashChangePlannedStartCommand adjust aspects of a running contract

func GetSlashChangeSpeedRunSinkCommand

func GetSlashChangeSpeedRunSinkCommand(cmd string) *dc.Command

GetSlashChangeSpeedRunSinkCommand returns the slash command for changing speedrun sinks

func GetSlashContractCommand

func GetSlashContractCommand(cmd string) *dc.Command

GetSlashContractCommand returns the slash command for creating a contract

func GetSlashContractReportCommand

func GetSlashContractReportCommand(cmd string) *dc.Command

GetSlashContractReportCommand returns the command for the /contract-report command

func GetSlashContractSettingsCommand

func GetSlashContractSettingsCommand(cmd string) *dc.Command

GetSlashContractSettingsCommand returns the command definition for contract settings

func GetSlashCoopETACommand

func GetSlashCoopETACommand(cmd string) *dc.Command

GetSlashCoopETACommand returns the command definition for the coopeta command

func GetSlashCoopTval

func GetSlashCoopTval(cmd string) *dc.Command

GetSlashCoopTval calculates the coop token value of a running contract

func GetSlashCsEstimates

func GetSlashCsEstimates(cmd string) *dc.Command

GetSlashCsEstimates returns the slash command for estimating scores

func GetSlashCustomBoostOrderCommand

func GetSlashCustomBoostOrderCommand(cmd string) *dc.Command

GetSlashCustomBoostOrderCommand defines the /custom-boost-order slash command with craft, delete, and help subcommands.

func GetSlashDefineCustomOrderCommand

func GetSlashDefineCustomOrderCommand(cmd string) *dc.Command

GetSlashDefineCustomOrderCommand is a backwards-compatible alias for GetSlashCustomBoostOrderCommand.

func GetSlashEstimateTime

func GetSlashEstimateTime(cmd string) *dc.Command

GetSlashEstimateTime is the definition of the slash command

func GetSlashHelpCommand

func GetSlashHelpCommand(cmd string) *dc.Command

GetSlashHelpCommand returns the command for the /help command

func GetSlashJoinContractCommand

func GetSlashJoinContractCommand(cmd string) *dc.Command

GetSlashJoinContractCommand returns the command definition for joining a contract

func GetSlashLeaderboard

func GetSlashLeaderboard(cmd string) *dc.Command

GetSlashLeaderboard returns the /leaderboard command

func GetSlashLinkAlternateCommand

func GetSlashLinkAlternateCommand(cmd string) *dc.Command

GetSlashLinkAlternateCommand allows a player to associate an alt.

func GetSlashLobbyCommand

func GetSlashLobbyCommand(cmd string) *dc.Command

GetSlashLobbyCommand returns the slash command for showing the current coop lobby.

func GetSlashPruneCommand

func GetSlashPruneCommand(cmd string) *dc.Command

GetSlashPruneCommand returns the command definition for pruning a booster

func GetSlashRegisterAltCommand

func GetSlashRegisterAltCommand(cmd string) *dc.Command

GetSlashRegisterAltCommand returns the /register-alt command

func GetSlashRegisterCommand

func GetSlashRegisterCommand(cmd string) *dc.Command

GetSlashRegisterCommand returns the /register command

func GetSlashRenameThread

func GetSlashRenameThread(cmd string) *dc.Command

GetSlashRenameThread is the definition of the slash command

func GetSlashRerunEvalCommand

func GetSlashRerunEvalCommand(cmd string) *dc.Command

GetSlashRerunEvalCommand returns the command for the /launch-helper command

func GetSlashScoreExplorerCommand

func GetSlashScoreExplorerCommand(cmd string) *dc.Command

GetSlashScoreExplorerCommand returns the slash command for token tracking

func GetSlashSkipCommand

func GetSlashSkipCommand(cmd string) *dc.Command

GetSlashSkipCommand returns the command definition for skipping a booster

func GetSlashSpeedrunCommand

func GetSlashSpeedrunCommand(cmd string) *dc.Command

GetSlashSpeedrunCommand returns the slash command for speedrun

func GetSlashStones

func GetSlashStones(cmd string) *dc.Command

GetSlashStones will return the discord command for calculating ideal stone set

func GetSlashTeamworkEval

func GetSlashTeamworkEval(cmd string) *dc.Command

GetSlashTeamworkEval will return the discord command for calculating token values of a running contract

func GetSlashToggleContractPingsCommand

func GetSlashToggleContractPingsCommand(cmd string) *dc.Command

GetSlashToggleContractPingsCommand returns the command definition for toggling pings

func GetSlashTokenEditCommand

func GetSlashTokenEditCommand(cmd string) *dc.Command

GetSlashTokenEditCommand returns the slash command for token tracking removal

func GetSlashUnboostCommand

func GetSlashUnboostCommand(cmd string) *dc.Command

GetSlashUnboostCommand returns the command definition for unboosting

func GetSlashUpdateCommand

func GetSlashUpdateCommand(cmd string) *dc.Command

GetSlashUpdateCommand returns the /update slash command with main subcommand groups for farmer and contract

func GetSlashUploadBannerCommand

func GetSlashUploadBannerCommand(cmd string) *dc.Command

GetSlashUploadBannerCommand returns the command definition for uploading a custom banner

func GetSlashVolunteerSink

func GetSlashVolunteerSink(cmd string) *dc.Command

GetSlashVolunteerSink is used to volunteer as token sink for a contract

func GetSlashVoluntellSink

func GetSlashVoluntellSink(cmd string) *dc.Command

GetSlashVoluntellSink is used to volunteer as token sink for a contract

func GetTargetBuffTimeValue

func GetTargetBuffTimeValue(cxpVersion int, durationSec float64) float64

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

func GetTargetTval(cxpVersion int, contractMinutes float64, minutesPerToken float64) float64

GetTargetTval will return the target tval for the contract based on the contract duration and minutes per token

func GetThematicComplaintsForContract

func GetThematicComplaintsForContract(contractID string) ([]string, error)

GetThematicComplaintsForContract returns complaints for one contract without loading the full complaint map.

func GetWish

func GetWish(guildID string, channelID string) string

GetWish gets the wish for a contract identified by the guild ID and channel ID.

func HandleActiveContractsPage

func HandleActiveContractsPage(client dc.Client, e *dc.ComponentEvent)

HandleActiveContractsPage handles button interactions for the active-contracts message.

func HandleAdminContractList

func HandleAdminContractList(client dc.Client, e *dc.CommandEvent)

HandleAdminContractList opens the admin contract list panel.

It still takes a raw session because ArchiveContracts is not on the facade yet.

func HandleAdminContractListComponent

func HandleAdminContractListComponent(client dc.Client, e *dc.ComponentEvent)

HandleAdminContractListComponent drives the admin contract list panel.

It still takes a raw session because finishContractByHash and ArchiveContracts are not on the facade yet.

func HandleAdminCurrentContracts

func HandleAdminCurrentContracts(client dc.Client, e *dc.CommandEvent)

HandleAdminCurrentContracts handles the admin current-contracts command.

func HandleAdminExitButton

func HandleAdminExitButton(client dc.Client, e *dc.ComponentEvent)

HandleAdminExitButton handles the admin-exit button clicks (confirm, cancel, and page navigation).

func HandleAdminExitCommand

func HandleAdminExitCommand(client dc.Client, e *dc.CommandEvent)

HandleAdminExitCommand handles the admin-exit command to gracefully shutdown the bot.

func HandleAdminGetContractData

func HandleAdminGetContractData(e *dc.CommandEvent)

HandleAdminGetContractData gets JSON data about a contract given the contract and coop id.

func HandleAdminGuildStateAutoComplete

func HandleAdminGuildStateAutoComplete(client dc.Client, e *dc.AutocompleteEvent)

HandleAdminGuildStateAutoComplete serves guild-id suggestions from persisted guildstate keys.

func HandleAdminGuildStateCommand

func HandleAdminGuildStateCommand(client dc.Client, e *dc.CommandEvent)

HandleAdminGuildStateCommand routes to guildstate handlers with explicit guild override.

func HandleAdminListRoles

func HandleAdminListRoles(client dc.Client, e *dc.CommandEvent)

HandleAdminListRoles is the handler for the list roles command.

func HandleAdminMembers

func HandleAdminMembers(client dc.Client, e *dc.CommandEvent)

HandleAdminMembers handles the set, remove, and list subcommands for admin-members.

func HandleAdminStatusMessageAutoComplete

func HandleAdminStatusMessageAutoComplete(e *dc.AutocompleteEvent)

HandleAdminStatusMessageAutoComplete provides status message suggestions.

func HandleAdminStatusMessageCommand

func HandleAdminStatusMessageCommand(client dc.Client, e *dc.CommandEvent)

HandleAdminStatusMessageCommand sets a one-time status message override.

func HandleAdminTasksAutocomplete

func HandleAdminTasksAutocomplete(e *dc.AutocompleteEvent)

HandleAdminTasksAutocomplete provides autocomplete suggestions for administrative tasks and parameters.

func HandleAdminTasksCommand

func HandleAdminTasksCommand(client dc.Client, e *dc.CommandEvent)

HandleAdminTasksCommand executes the chosen administrative task.

func HandleAllContractsAutoComplete

func HandleAllContractsAutoComplete(e *dc.AutocompleteEvent)

HandleAllContractsAutoComplete will handle the contract auto complete of contract-id's default to new contracts but allow searching all contracts

func HandleAltsAutoComplete

func HandleAltsAutoComplete(e *dc.AutocompleteEvent)

HandleAltsAutoComplete will populate with linked alternate names

func HandleArtifactAltAutoComplete

func HandleArtifactAltAutoComplete(e *dc.AutocompleteEvent)

HandleArtifactAltAutoComplete suggests the alternates linked to the caller.

func HandleArtifactCommand

func HandleArtifactCommand(client dc.Client, e *dc.CommandEvent)

HandleArtifactCommand shows the artifact picker for the caller or one of their alternates. It also clears any manual IHR override and updates running contracts.

func HandleArtifactReactions

func HandleArtifactReactions(client dc.Client, e *dc.ComponentEvent)

HandleArtifactReactions handles all the button reactions for a contract settings.

It still takes a raw session because updateFarmerInContracts and refreshBoostListMessage are not on the facade yet.

func HandleAvailabilityCommand

func HandleAvailabilityCommand(client dc.Client, e *dc.CommandEvent)

HandleAvailabilityCommand handles the /availability command through the dc facade.

It still takes a raw session because creatorOfContract is not on the facade yet.

func HandleBoostCommand

func HandleBoostCommand(client dc.Client, e *dc.CommandEvent)

HandleBoostCommand will handle the /boost command

func HandleBoostOrderCommand

func HandleBoostOrderCommand(client dc.Client, e *dc.CommandEvent)

HandleBoostOrderCommand handles the /boost-order command, starting an interactive session to reorder the boost order for a contract.

func HandleBoostOrderHelpersCommand

func HandleBoostOrderHelpersCommand(client dc.Client, e *dc.CommandEvent)

HandleBoostOrderHelpersCommand handles the /boost-order-helpers command.

func HandleBoostOrderReactions

func HandleBoostOrderReactions(client dc.Client, e *dc.ComponentEvent)

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(client dc.Client, e *dc.CommandEvent)

HandleBumpCRCommand will handle the /bump-cr command

func HandleBumpCommand

func HandleBumpCommand(client dc.Client, e *dc.CommandEvent)

HandleBumpCommand will handle the /bump command

func HandleChangeCommand

func HandleChangeCommand(client dc.Client, e *dc.CommandEvent)

HandleChangeCommand handles the /update slash command through the dc facade.

It still takes a raw session because the contract mutators and the boost list redraw are not on the facade yet.

func HandleChangeOneBoosterCommand

func HandleChangeOneBoosterCommand(client dc.Client, e *dc.CommandEvent)

HandleChangeOneBoosterCommand handles the /change-one-booster command through the dc facade.

It still takes a raw session because the boost order mutators are not on the facade yet.

func HandleChangePlannedStartCommand

func HandleChangePlannedStartCommand(client dc.Client, e *dc.CommandEvent)

HandleChangePlannedStartCommand handles the /change-planned-start command through the dc facade.

It still takes a raw session because creatorOfContract and the boost list redraw are not on the facade yet.

func HandleChangeSpeedrunSinkCommand

func HandleChangeSpeedrunSinkCommand(client dc.Client, e *dc.CommandEvent)

HandleChangeSpeedrunSinkCommand handles the change speedrun sink command

func HandleChartReactions

func HandleChartReactions(e *dc.ComponentEvent)

HandleChartReactions handles button and select menu interactions for the chart view.

func HandleContractAutoComplete

func HandleContractAutoComplete(e *dc.AutocompleteEvent)

HandleContractAutoComplete will handle the contract auto complete of contract-id's

func HandleContractCalcContractTvalCommand

func HandleContractCalcContractTvalCommand(e *dc.CommandEvent)

HandleContractCalcContractTvalCommand will handle the /contract-token-tval command

func HandleContractCommand

func HandleContractCommand(client dc.Client, e *dc.CommandEvent)

HandleContractCommand will handle the /contract command

func HandleContractDelete

func HandleContractDelete(client dc.Client, e *dc.ComponentEvent)

HandleContractDelete facilitates the deletion of a channel contract

func HandleContractReactions

func HandleContractReactions(client dc.Client, e *dc.ComponentEvent)

HandleContractReactions handles all the button reactions for a contract.

It still takes a raw session because the boost order helpers and the boost list redraw are not on the facade yet.

func HandleContractReport

func HandleContractReport(e *dc.CommandEvent)

HandleContractReport handles the /contract-report command.

func HandleContractSettingsCommand

func HandleContractSettingsCommand(client dc.Client, e *dc.CommandEvent)

HandleContractSettingsCommand will handle the /contract-settings command

func HandleContractSettingsReactions

func HandleContractSettingsReactions(client dc.Client, e *dc.ComponentEvent)

HandleContractSettingsReactions handles all the button reactions for a contract settings

func HandleCoopAutoComplete

func HandleCoopAutoComplete(e *dc.AutocompleteEvent)

HandleCoopAutoComplete will handle the contract auto complete of contract-id's

func HandleCoopETACommand

func HandleCoopETACommand(e *dc.CommandEvent)

HandleCoopETACommand will handle the /coopeta command

func HandleCoopStatusPermissionButton

func HandleCoopStatusPermissionButton(e *dc.ComponentEvent)

HandleCoopStatusPermissionButton handles button interactions for the permission dialog through the dc facade.

func HandleCoopTvalCommand

func HandleCoopTvalCommand(client dc.Client, e *dc.CommandEvent)

HandleCoopTvalCommand will handle the /contract-token-tval command. It is also called from /bump, which has already answered its own interaction, so every response here is skipped when the command name is "bump".

func HandleCsEstimateButtons

func HandleCsEstimateButtons(e *dc.ComponentEvent)

HandleCsEstimateButtons handles button interactions for /cs-estimate.

func HandleCsEstimatesCommand

func HandleCsEstimatesCommand(e *dc.CommandEvent)

HandleCsEstimatesCommand handles the estimate scores command.

func HandleCustomBoostOrderAutoComplete

func HandleCustomBoostOrderAutoComplete(e *dc.AutocompleteEvent)

HandleCustomBoostOrderAutoComplete provides autocomplete options for /custom-boost-order.

func HandleCustomBoostOrderCommand

func HandleCustomBoostOrderCommand(client dc.Client, e *dc.CommandEvent)

HandleCustomBoostOrderCommand handles invocation of /custom-boost-order.

func HandleCustomOrderModalSubmit

func HandleCustomOrderModalSubmit(client dc.Client, e *dc.ModalEvent)

HandleCustomOrderModalSubmit processes the submitted custom boost order modal dialog.

func HandleCustomOrderReactions

func HandleCustomOrderReactions(client dc.Client, e *dc.ComponentEvent)

HandleCustomOrderReactions processes button clicks on the Custom Boost Order preview catalyst.

func HandleDefineCustomOrderAutoComplete

func HandleDefineCustomOrderAutoComplete(e *dc.AutocompleteEvent)

HandleDefineCustomOrderAutoComplete provides backwards-compatible autocomplete.

func HandleDefineCustomOrderCommand

func HandleDefineCustomOrderCommand(client dc.Client, e *dc.CommandEvent)

HandleDefineCustomOrderCommand provides backwards-compatible invocation.

func HandleDefineCustomOrderModalSubmit

func HandleDefineCustomOrderModalSubmit(_ dc.Client, e *dc.ModalEvent)

HandleDefineCustomOrderModalSubmit processes the submitted 4-line criteria modal.

func HandleDefineCustomOrderReactions

func HandleDefineCustomOrderReactions(client dc.Client, e *dc.ComponentEvent)

HandleDefineCustomOrderReactions handles MODIFY, SAVE, PUBLISH, SELECT, DELETE button clicks.

func HandleEggIDModalSubmit

func HandleEggIDModalSubmit(e *dc.ModalEvent)

HandleEggIDModalSubmit stores the submitted Egg Inc ID and resumes whichever command asked for it.

It still takes a raw session because the commands it resumes are not on the facade yet.

func HandleEstimateTimeCommand

func HandleEstimateTimeCommand(e *dc.CommandEvent)

HandleEstimateTimeCommand will handle the estimate-contract-time command

func HandleHelpCommand

func HandleHelpCommand(client dc.Client, e *dc.CommandEvent)

HandleHelpCommand will handle the help command

func HandleJoinCommand

func HandleJoinCommand(client dc.Client, e *dc.CommandEvent)

HandleJoinCommand will handle the /join command

func HandleLeaderboard

func HandleLeaderboard(e *dc.CommandEvent)

HandleLeaderboard posts the leaderboard for the requested season.

func HandleLeaderboardAutoComplete

func HandleLeaderboardAutoComplete(e *dc.AutocompleteEvent)

HandleLeaderboardAutoComplete suggests seasons for the /leaderboard season option.

func HandleLeaderboardPage

func HandleLeaderboardPage(e *dc.ComponentEvent)

HandleLeaderboardPage drives the season selector, Refresh and Close controls.

func HandleLeaderboardPermissionButton

func HandleLeaderboardPermissionButton(e *dc.ComponentEvent)

HandleLeaderboardPermissionButton records the answer to the permission dialog and closes it.

func HandleLinkAlternateAutoComplete

func HandleLinkAlternateAutoComplete(e *dc.AutocompleteEvent)

HandleLinkAlternateAutoComplete will handle the /link-alternate autocomplete through the dc facade.

func HandleLinkAlternateCommand

func HandleLinkAlternateCommand(client dc.Client, e *dc.CommandEvent)

HandleLinkAlternateCommand handles the /link-alternate command through the dc facade.

It still takes a raw session because the boost list redraw is not on the facade yet.

func HandleLobbyButtons

func HandleLobbyButtons(client dc.Client, e *dc.ComponentEvent)

HandleLobbyButtons handles refresh, ping, and close button interactions for /lobby.

func HandleLobbyCommand

func HandleLobbyCommand(e *dc.CommandEvent)

HandleLobbyCommand handles the /lobby slash command.

func HandleMenuReactions

func HandleMenuReactions(client dc.Client, e *dc.ComponentEvent)

HandleMenuReactions handles the menu reactions for the contract.

It still takes a raw session because the boost list redraw, the token helpers and the sandbox DM are not on the facade yet.

func HandlePredCommand

func HandlePredCommand(client dc.Client, e *dc.CommandEvent)

HandlePredCommand dispatches /pred subcommands.

func HandlePredPage

func HandlePredPage(client dc.Client, e *dc.ComponentEvent)

HandlePredPage handles select menu and button interactions for /pred.

func HandlePredictionsCommand

func HandlePredictionsCommand(client dc.Client, e *dc.CommandEvent)

HandlePredictionsCommand will handle the /predictions command

func HandlePredictionsPage

func HandlePredictionsPage(e *dc.ComponentEvent)

HandlePredictionsPage handles interaction for prediction pages

func HandlePruneCommand

func HandlePruneCommand(client dc.Client, e *dc.CommandEvent)

HandlePruneCommand will handle the /prune command

func HandlePublishCustomOrderModalSubmit

func HandlePublishCustomOrderModalSubmit(_ dc.Client, e *dc.ModalEvent)

HandlePublishCustomOrderModalSubmit processes publishing the named custom order preset globally.

func HandleRegister

func HandleRegister(e *dc.CommandEvent)

HandleRegister asks for the caller's Egg Inc ID.

func HandleRegisterAlt

func HandleRegisterAlt(e *dc.CommandEvent)

HandleRegisterAlt asks for the alternate's Egg Inc ID.

func HandleRegisterAltAutocomplete

func HandleRegisterAltAutocomplete(e *dc.AutocompleteEvent)

HandleRegisterAltAutocomplete suggests the alternates the caller controls.

func HandleRenameThreadCommand

func HandleRenameThreadCommand(client dc.Client, e *dc.CommandEvent)

HandleRenameThreadCommand will handle the thread rename command

func HandleReplayEval

func HandleReplayEval(e *dc.CommandEvent)

HandleReplayEval handles the /replay-eval command.

func HandleRerunEvalAutoComplete

func HandleRerunEvalAutoComplete(e *dc.AutocompleteEvent)

HandleRerunEvalAutoComplete dispatches autocomplete for /rerun-eval subcommands. The "active" subcommand gets contract-id autocomplete; the "season" subcommand gets season autocomplete powered by leaderboardSeasons().

func HandleRerunEvalSeasonAutoComplete

func HandleRerunEvalSeasonAutoComplete(e *dc.AutocompleteEvent)

HandleRerunEvalSeasonAutoComplete suggests seasons for the /rerun-eval season option.

func HandleRestartContract

func HandleRestartContract(client dc.Client, e *dc.ComponentEvent)

HandleRestartContract recycles the current contract and recreates it with the same participants, planned start time, and run style.

func HandleSaveCustomOrderModalSubmit

func HandleSaveCustomOrderModalSubmit(_ dc.Client, e *dc.ModalEvent)

HandleSaveCustomOrderModalSubmit processes saving the named custom order preset.

func HandleScoreExplorerCommand

func HandleScoreExplorerCommand(e *dc.CommandEvent)

HandleScoreExplorerCommand handles the score explorer command through the dc facade.

func HandleScoreExplorerPage

func HandleScoreExplorerPage(e *dc.ComponentEvent)

HandleScoreExplorerPage steps a page of the score explorer through the dc facade.

func HandleSignupBell

func HandleSignupBell(client dc.Client, e *dc.ComponentEvent)

HandleSignupBell handles the interaction for joining a contract with a bell

func HandleSignupFarmer

func HandleSignupFarmer(client dc.Client, e *dc.ComponentEvent)

HandleSignupFarmer handles the interaction for joining a contract as a farmer

func HandleSignupLeave

func HandleSignupLeave(client dc.Client, e *dc.ComponentEvent)

HandleSignupLeave handles the interaction for leaving a contract.

It still takes a raw session because RemoveFarmerByMention is not on the facade yet.

func HandleSignupStart

func HandleSignupStart(client dc.Client, e *dc.ComponentEvent)

HandleSignupStart handles the interaction for starting the signup process.

It still takes a raw session because StartContractBoosting and the signup message rebuild are not on the facade yet.

func HandleSkipCommand

func HandleSkipCommand(client dc.Client, e *dc.CommandEvent)

HandleSkipCommand will handle the /skip command

func HandleSlashVolunteerSinkCommand

func HandleSlashVolunteerSinkCommand(client dc.Client, e *dc.CommandEvent)

HandleSlashVolunteerSinkCommand is used to volunteer as token sink for a contract.

It still takes a raw session because RedrawBoostList is not on the facade yet.

func HandleSlashVoluntellSinkCommand

func HandleSlashVoluntellSinkCommand(client dc.Client, e *dc.CommandEvent)

HandleSlashVoluntellSinkCommand is used to volunteer as token sink for a contract.

It still takes a raw session because RedrawBoostList is not on the facade yet.

func HandleSpeedrunCommand

func HandleSpeedrunCommand(client dc.Client, e *dc.CommandEvent)

HandleSpeedrunCommand handles the speedrun command

func HandleStonesCommand

func HandleStonesCommand(client dc.Client, e *dc.CommandEvent)

HandleStonesCommand handles the /stones command through the dc facade.

It still takes a raw session because the boost list redraw is not on the facade yet.

func HandleStonesPage

func HandleStonesPage(client dc.Client, e *dc.ComponentEvent)

HandleStonesPage steps a page of cached stones data through the dc facade.

It still takes a raw session because sendStonesPage can trigger a boost list redraw, which is not on the facade yet.

func HandleTeamworkEvalCommand

func HandleTeamworkEvalCommand(e *dc.CommandEvent)

HandleTeamworkEvalCommand will handle the /teamwork command through the dc facade.

func HandleTeamworkPage

func HandleTeamworkPage(e *dc.ComponentEvent)

HandleTeamworkPage steps a page of cached teamwork data through the dc facade.

func HandleThresholdModalSubmit

func HandleThresholdModalSubmit(client dc.Client, e *dc.ModalEvent)

HandleThresholdModalSubmit processes the submitted threshold tokens modal dialog

func HandleToggleContractPingsCommand

func HandleToggleContractPingsCommand(client dc.Client, e *dc.CommandEvent)

HandleToggleContractPingsCommand will handle the /toggle-contract-pings command

func HandleTokenEditAutoComplete

func HandleTokenEditAutoComplete(e *dc.AutocompleteEvent)

HandleTokenEditAutoComplete will handle the /token-edit autocomplete

func HandleTokenEditCommand

func HandleTokenEditCommand(client dc.Client, e *dc.CommandEvent) string

HandleTokenEditCommand will handle the /token-edit command

func HandleTokenEditInteraction

func HandleTokenEditInteraction(client dc.Client, e *dc.CommandEvent)

HandleTokenEditInteraction handles the /token-edit command interaction

func HandleUnboostCommand

func HandleUnboostCommand(client dc.Client, e *dc.CommandEvent)

HandleUnboostCommand will handle the /unboost command

func HandleUpdateCommand

func HandleUpdateCommand(client dc.Client, e *dc.CommandEvent)

HandleUpdateCommand handles the /update slash command through the dc facade.

It still takes a raw session because the boost list redraw is not on the facade yet.

func HandleUploadBannerCommand

func HandleUploadBannerCommand(client dc.Client, e *dc.CommandEvent)

HandleUploadBannerCommand handles the /upload-banner command

func IsRoleCreatedByBot

func IsRoleCreatedByBot(roleName string) bool

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

func IsUserCreatorOfAnyContract(client dc.Client, userID string) bool

IsUserCreatorOfAnyContract will return true if the user is the creator of any contract

func JoinContract

func JoinContract(client dc.Client, 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 LoadMissingContracts

func LoadMissingContracts() (map[string]int64, error)

LoadMissingContracts loads missing contracts and their initial missing timestamps from the database.

func LoadRoleNames

func LoadRoleNames() (map[string][]string, error)

LoadRoleNames loads all contract roles from the database

func LoadThematicComplaints

func LoadThematicComplaints() (map[string][]string, error)

LoadThematicComplaints loads all contract complaints from the database, using an in-memory cache to match previous behavior.

func MoveBooster

func MoveBooster(client dc.Client, 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 NormalizeTimeslotValues

func NormalizeTimeslotValues(selected []string, previous []string) []string

NormalizeTimeslotValues handles selection of "ALL Times" vs individual timeslots.

func PopulateContractFromProto

func PopulateContractFromProto(contractProtoBuf *ei.Contract) ei.EggIncContract

PopulateContractFromProto will populate a contract from a protobuf

func PopulateThematicComplaintsForContractID

func PopulateThematicComplaintsForContractID(contractID string, complaints []string)

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 PublishAMQPBoostStatus

func PublishAMQPBoostStatus(guildID string, url string, contractID string, coopID string, status AMQPBoostStatusMessage)

PublishAMQPBoostStatus publishes a boost status update to the guild's AMQP queue.

func PublishAMQPBoosterChange

func PublishAMQPBoosterChange(guildID string, url string, status AMQPBoosterChangeMessage)

PublishAMQPBoosterChange publishes a booster join/remove event to the guild's AMQP queue.

func PublishAMQPContractStart

func PublishAMQPContractStart(guildID string, url string, status AMQPContractStartMessage)

PublishAMQPContractStart publishes a contract start event to the guild's AMQP queue.

func PublishAMQPContractUpdate

func PublishAMQPContractUpdate(guildID string, url string, status AMQPContractUpdateMessage)

PublishAMQPContractUpdate publishes a contract update/reset event to the guild's AMQP queue.

func PublishAMQPNonToken

func PublishAMQPNonToken(guildID string, url string, contractID string, coopID string, status AMQPNonTokenMessage)

PublishAMQPNonToken publishes a non-token event to the guild's AMQP queue.

func PublishAMQPTokenLog

func PublishAMQPTokenLog(guildID string, url string, contractID string, coopID string, logEntry AMQPTokenMessage)

PublishAMQPTokenLog publishes a token log to the guild's AMQP queue.

func PublishGlobalCustomOrder

func PublishGlobalCustomOrder(tmpl CustomBoostOrderTemplate)

PublishGlobalCustomOrder saves or updates a custom boost order globally across all servers.

func ReactionAdd

func ReactionAdd(client dc.Client, e *dc.ReactionEvent) string

ReactionAdd is called when a reaction is added to a message

func ReactionRemove

func ReactionRemove(_ dc.Client, _ *dc.ReactionEvent)

ReactionRemove handles a user removing a reaction from a message

func RedrawBoostList

func RedrawBoostList(client dc.Client, guildID string, channelID string) error

RedrawBoostList will move the boost message to the bottom of the channel

func RefreshGuildContractsForBannerUpdate

func RefreshGuildContractsForBannerUpdate(client dc.Client, guildID string)

RefreshGuildContractsForBannerUpdate updates banner URLs and redraws boost lists for active contracts associated with the given guild.

func Register

func Register(e *dc.ModalEvent, 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(e *dc.ModalEvent, targetAlt string, encryptedID string)

RegisterAlt processes the register-alt modal submission.

func RegisterEggIDModalAction

func RegisterEggIDModalAction(action string, handler func(e *dc.ModalEvent, options dc.OptionValues, encryptedID string, okayToSave bool))

RegisterEggIDModalAction registers a handler for an external action key in the EggID modal.

func RemoveAddedReaction

func RemoveAddedReaction(client dc.Client, e *dc.ReactionEvent)

RemoveAddedReaction removes an added reaction from a message so it can be reactivated

func RemoveFarmerByMention

func RemoveFarmerByMention(client dc.Client, guildID string, channelID string, operator string, mention string) error

RemoveFarmerByMention will remove a booster from the contract by mention

func RenderCustomOrderTableImage

func RenderCustomOrderTableImage(contract *Contract, lines []string) ([]byte, error)

RenderCustomOrderTableImage renders a PNG table image of the custom boost order.

func RenderScoreTableANSI

func RenderScoreTableANSI(rows []srRow, srmode bool, includeDiff bool) string

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 RenderScoreTableImage

func RenderScoreTableImage(rows []srRow, srmode bool, includeDiff bool) ([]byte, error)

RenderScoreTableImage renders the score table as a PNG image using RenderTableImage.

func RenderTableImage

func RenderTableImage(cols []TableImageColumn, rows []TableImageRow) ([]byte, error)

RenderTableImage renders a generic table of columns and rows as a PNG image.

func ReplaceThematicComplaintsForContractID

func ReplaceThematicComplaintsForContractID(contractID string, complaints []string)

ReplaceThematicComplaintsForContractID replaces thematic complaints on active contracts for a contract ID.

func RequestEggIncIDModal

func RequestEggIncIDModal(e *dc.CommandEvent, action string, options dc.OptionValues)

RequestEggIncIDModal sends a modal to the user requesting their Egg Inc ID

func RerunEval

func RerunEval(e dc.InteractionEvent, options dc.OptionValues, eiID string, okayToSave bool)

RerunEval evaluates the contract history and provides replay guidance

func SaveAllData

func SaveAllData()

SaveAllData will save all contract data to disk

func SaveMissingContract

func SaveMissingContract(contractID string, timestamp int64) error

SaveMissingContract inserts or updates a missing contract timestamp in the database.

func SaveRoleNames

func SaveRoleNames(data map[string][]string)

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

func SaveThematicComplaints(data map[string][]string) error

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 SaveUserCustomOrder

func SaveUserCustomOrder(userID string, tmpl CustomBoostOrderTemplate)

SaveUserCustomOrder saves or updates a custom boost order template for a user.

func SendCustomBoostOrderModal

func SendCustomBoostOrderModal(e *dc.ComponentEvent, contractHash string)

SendCustomBoostOrderModal displays a 4-row modal to configure custom boost order rules.

func SendDefineCustomOrderModalFromCommand

func SendDefineCustomOrderModalFromCommand(e *dc.CommandEvent, contract *Contract, initial *CustomBoostOrderTemplate)

SendDefineCustomOrderModalFromCommand presents the 4-line criteria modal in response to a CommandEvent.

func SendDefineCustomOrderModalFromComponent

func SendDefineCustomOrderModalFromComponent(e *dc.ComponentEvent, tmpl CustomBoostOrderTemplate, sessionUUID string)

SendDefineCustomOrderModalFromComponent presents the 4-line criteria modal in response to a ComponentEvent (e.g. MODIFY button).

func SendPublishCustomOrderModal

func SendPublishCustomOrderModal(e *dc.ComponentEvent, tmpl CustomBoostOrderTemplate, sessionUUID string)

SendPublishCustomOrderModal presents a modal dialog to name and publish the custom order globally.

func SendSandboxDM

func SendSandboxDM(client dc.Client, contract *Contract, userID string) error

SendSandboxDM builds and sends an SR Sandbox DM to a user.

func SendSaveCustomOrderModal

func SendSaveCustomOrderModal(e *dc.ComponentEvent, tmpl CustomBoostOrderTemplate, sessionUUID string)

SendSaveCustomOrderModal presents a modal dialog to name and save the custom order to user presets.

func SendThresholdModal

func SendThresholdModal(e *dc.ComponentEvent, contractHash string)

SendThresholdModal displays a modal to configure threshold tokens

func SetCustomBoostOrderDoc

func SetCustomBoostOrderDoc(data []byte)

SetCustomBoostOrderDoc stores the documentation content bytes for CustomBoostOrder.md.

func SetListMessageID

func SetListMessageID(contract *Contract, channelID string, messageID string)

SetListMessageID will save the list messageID for the contract

func SetPeriodicalsRefresher

func SetPeriodicalsRefresher(refresher PeriodicalsRefresherFunc)

SetPeriodicalsRefresher configures the function used to refresh periodicals from API.

func SetReactionID

func SetReactionID(contract *Contract, channelID string, reactionID string)

SetReactionID will save the reactionID for the contract

func SetStatusMessagesRefresher

func SetStatusMessagesRefresher(refresher StatusMessagesRefresherFunc)

SetStatusMessagesRefresher configures the function used to refresh status messages.

func SetThematicComplaintsGenerator

func SetThematicComplaintsGenerator(gen ThematicComplaintsGeneratorFunc)

SetThematicComplaintsGenerator configures the function used to generate complaints with LLM.

func SetTokenComplaintsRefresher

func SetTokenComplaintsRefresher(refresher TokenComplaintsRefresherFunc)

SetTokenComplaintsRefresher configures the function used to refresh token complaints.

func SetWish

func SetWish(guildID string, channelID string, wish string) error

SetWish sets the wish for a contract identified by the guild ID and channel ID.

func ShowCoopStatusPermissionDialog

func ShowCoopStatusPermissionDialog(e *dc.CommandEvent)

ShowCoopStatusPermissionDialog shows the ephemeral dialog with Allow and Close buttons

func ShowLeaderboardPermissionDialog

func ShowLeaderboardPermissionDialog(e dc.InteractionEvent)

ShowLeaderboardPermissionDialog shows the ephemeral dialog with Allow and Close buttons.

func SkipBooster

func SkipBooster(client dc.Client, guildID string, channelID string, userID string) error

SkipBooster will skip the current booster and move to the next

func SlashAdminCurrentContracts

func SlashAdminCurrentContracts(cmd string) *dc.Command

SlashAdminCurrentContracts creates the admin current-contracts command for Discord.

func SlashAdminExitCommand

func SlashAdminExitCommand(cmd string) *dc.Command

SlashAdminExitCommand provides an admin-only command to gracefully exit the bot.

func SlashAdminGetContractData

func SlashAdminGetContractData(cmd string) *dc.Command

SlashAdminGetContractData is the slash to get contract JSON data

func SlashAdminGuildStateCommand

func SlashAdminGuildStateCommand(cmd string) *dc.Command

SlashAdminGuildStateCommand provides a generic entrypoint for guildstate admin actions.

func SlashAdminListRoles

func SlashAdminListRoles(cmd string) *dc.Command

SlashAdminListRoles is the slash to info about bot roles

func SlashAdminMembers

func SlashAdminMembers(cmd string) *dc.Command

SlashAdminMembers returns the admin-members slash command definition with set/remove subcommands.

func SlashAdminStatusMessageCommand

func SlashAdminStatusMessageCommand(cmd string) *dc.Command

SlashAdminStatusMessageCommand sets the next bot status message.

func SlashAdminTasksCommand

func SlashAdminTasksCommand(cmd string) *dc.Command

SlashAdminTasksCommand returns the /admin-tasks command definition.

func SlashArtifactsCommand

func SlashArtifactsCommand(cmd string) *dc.Command

SlashArtifactsCommand creates a new slash command for setting Egg, Inc name

func StartContractBoosting

func StartContractBoosting(client dc.Client, guildID string, channelID string, userID string) error

StartContractBoosting will start the contract

func SuggestCustomOrderName

func SuggestCustomOrderName(lines []string) string

SuggestCustomOrderName analyzes custom boost order rule lines and generates a concise, readable preset name.

func Unboost

func Unboost(client dc.Client, guildID string, channelID string, mention string) error

Unboost will mark a user as unboosted

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(client dc.Client, 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

func UpdateThreadName(client dc.Client, contract *Contract)

UpdateThreadName will update a threads name to the current contract state

func UserBoost

func UserBoost(client dc.Client, guildID string, channelID string, userID string) error

UserBoost will trigger a contract boost of a user

func UserInContract

func UserInContract(c *Contract, u string) bool

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 AMQPBoostStatusMessage

type AMQPBoostStatusMessage struct {
	Event      string    `json:"event"`
	ContractID string    `json:"contract_id"`
	CoopID     string    `json:"coop_id"`
	UserID     string    `json:"user_id"`
	Nick       string    `json:"nick"`
	BoostState string    `json:"boost_state"` // "Unboosted", "TokenTime", "Boosted"
	Time       time.Time `json:"time"`
}

AMQPBoostStatusMessage represents a player's boost status change.

type AMQPBoosterChangeMessage

type AMQPBoosterChangeMessage struct {
	Event      string    `json:"event"` // "booster_join" or "booster_remove"
	ContractID string    `json:"contract_id"`
	CoopID     string    `json:"coop_id"`
	UserID     string    `json:"user_id"`
	Nick       string    `json:"nick"`
	Time       time.Time `json:"time"`
}

AMQPBoosterChangeMessage represents a join or remove event for a booster in a contract.

type AMQPClient

type AMQPClient struct {
	// contains filtered or unexported fields
}

AMQPClient manages the AMQP connection and channel for a single guild.

func (*AMQPClient) Close

func (c *AMQPClient) Close()

Close closes the AMQP connection and channel.

type AMQPContractStartMessage

type AMQPContractStartMessage struct {
	Event           string    `json:"event"`
	ContractID      string    `json:"contract_id"`
	CoopID          string    `json:"coop_id"`
	ChannelID       string    `json:"channel_id"`
	StartTime       time.Time `json:"start_time"`
	CoopSize        int       `json:"coop_size"`
	DeliveryTarget  float64   `json:"delivery_target"`
	GenerousGifts   string    `json:"generous_gifts"`
	GGMultiplier    float64   `json:"gg_multiplier,omitempty"`
	MinutesPerToken int       `json:"minutes_per_token"`
}

AMQPContractStartMessage represents details of a contract when started.

type AMQPContractUpdateMessage

type AMQPContractUpdateMessage struct {
	Event           string    `json:"event"`
	ContractID      string    `json:"contract_id"`
	CoopID          string    `json:"coop_id"`
	ChannelID       string    `json:"channel_id"`
	StartTime       time.Time `json:"start_time"`
	CoopSize        int       `json:"coop_size"`
	DeliveryTarget  float64   `json:"delivery_target"`
	GenerousGifts   string    `json:"generous_gifts"`
	GGMultiplier    float64   `json:"gg_multiplier,omitempty"`
	MinutesPerToken int       `json:"minutes_per_token"`
}

AMQPContractUpdateMessage represents details of a contract when updated/reset.

type AMQPNonTokenMessage

type AMQPNonTokenMessage struct {
	Event      string    `json:"event"`
	ContractID string    `json:"contract_id"`
	CoopID     string    `json:"coop_id"`
	UserID     string    `json:"user_id"`
	Nick       string    `json:"nick"`
	Time       time.Time `json:"time"`
}

AMQPNonTokenMessage represents a non-token delivery report.

type AMQPTokenMessage

type AMQPTokenMessage struct {
	Event      string    `json:"event"`
	ContractID string    `json:"contract_id"`
	CoopID     string    `json:"coop_id"`
	Time       time.Time `json:"time"`
	Quantity   int       `json:"quantity"`
	Value      float64   `json:"value"`
	FromUserID string    `json:"from_user_id"`
	FromNick   string    `json:"from_nick"`
	ToUserID   string    `json:"to_user_id"`
	ToNick     string    `json:"to_nick"`
	Boost      bool      `json:"boost"`
}

AMQPTokenMessage represents the structure of the token unit log sent over AMQP.

type AdminExitNotice

type AdminExitNotice struct {
	ApplicationID    string    `json:"application_id"`
	InteractionToken string    `json:"interaction_token"`
	MessageID        string    `json:"message_id"`
	ChannelID        string    `json:"channel_id"`
	GuildID          string    `json:"guild_id"`
	UserID           string    `json:"user_id"`
	ExitTime         time.Time `json:"exit_time"`
	InitialText      string    `json:"initial_text"`
}

AdminExitNotice tracks metadata for an admin-requested exit to update the ephemeral message on startup.

type ArtifactSet

type ArtifactSet struct {
	Artifacts []ei.Artifact
	LayRate   float64
	ShipRate  float64
}

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 BoostResult

type BoostResult struct {
	Strategy   string
	Tokens     int
	Multiplier float64
	TotalTime  float64
}

BoostResult holds the strategy name, token count, boost multiplier, and calculated total time.

func FindFastestBoost

func FindFastestBoost(te int, tokenRate float64, sixTokBoostTime float64, artifactMult ...float64) BoostResult

FindFastestBoost determines the optimal boost strategy and its duration for a given TE level and optional artifact multiplier.

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
	IsAlt         bool     // True if designated as an alternate account in this contract

	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
	LastCRAttempt          time.Time            // Time user last clicked the CR button (when not boosted)
	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
	IHRRate                float64              // Internal Hatchery Rate for IHR Order
	IHRCalcLog             string               // Plain text log of IHR calculation details
	FuzzyOffset            float64              // Fuzzy random offset applied during fuzzy TE or IHR ordering
	Availability           ContractAvailability // Availability for contracts
	NonTokenReactionTimes  []time.Time          // Timestamps of no-token button interactions
	NonTokenMsgID          string               // Last ephemeral message ID for user reaction summary log
	DisableEphemeralLog    bool                 // Toggle for user ephemeral reaction summary log
}

Booster holds the data for each booster within a Contract

func AddFarmerToContract

func AddFarmerToContract(client dc.Client, contract *Contract, guildID string, channelID string, userID string, order int, progenitor bool, alreadyBoosted bool) (*Booster, error)

AddFarmerToContract adds a farmer to a contract

func (*Booster) DisplayName

func (b *Booster) DisplayName() string

DisplayName returns the booster's display name, falling back through Nick, Name, UserName, GlobalName, and UserID.

type CompMap

type CompMap struct {
	Emoji          string
	ID             string
	Name           string
	Style          dc.ButtonStyle
	CustomID       string
	ComponentEmoji *dc.Emoji
}

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
	WasPredictedContract      bool             // True if this contract was created as a prediction contract
	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
	ThreadRenameFinalized     bool
	EstimateUpdateTime        time.Time
	LastLobbyPingTime         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
	ThresholdTokensX           int   // X tokens for >= A TE
	ThresholdTokensY           int   // Y tokens < A TE
	ThresholdTokensA           int   // A TE threshold
	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
	CRNoticeCount              int                 // Number of times CR dialog has been displayed
	WaitlistBoosters           []string            // Waitlist of UserID's
	Order                      []string
	OriginalOrder              []string   // Initial sorted order when contract boosting starts
	BoostedOrder               []string   // Actual order of boosting
	OrderRevision              int        // Incremented when Order is changed
	Banker                     BankerInfo // Banker for the contract
	TokenLog                   []ei.TokenUnitLog
	LastPublishedTokenLogIndex int            `json:"last_published_token_log_index"`
	LastPublishedStates        map[string]int `json:"last_published_states"`
	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
	CustomOrderLines   []string  // Custom boost order rules (up to 4 rows)
	CustomOrderName    string    // Custom boost order name
	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(client dc.Client, 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

func FindContract(channelID string) *Contract

FindContract will find the contract by the guildID and channelID

func FindContractByHash

func FindContractByHash(hash string) *Contract

FindContractByHash will find a contract by its hash

func FindContractByIDs

func FindContractByIDs(channelID string, contractID string, coopID string) *Contract

FindContractByIDs will find the contract by the contractID and coopID, optionally filtering by channelID if it is a TBD coop

func FindContractByMessageID

func FindContractByMessageID(channelID string, messageID string) *Contract

FindContractByMessageID will find the contract by the messageID

func (*Contract) IsOrWasPrediction

func (c *Contract) IsOrWasPrediction() bool

IsOrWasPrediction returns true if the contract is currently a prediction contract or was created as a prediction contract.

func (*Contract) UnmarshalJSON

func (c *Contract) UnmarshalJSON(data []byte) error

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 ContractComplaint struct {
	Contractid string
	Complaint  string
}

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 ContractRole struct {
	Contractid string
	RoleName   string
}

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(channelID string, 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 CustomBoostOrderTemplate

type CustomBoostOrderTemplate struct {
	Name      string   `json:"name"`
	Lines     []string `json:"lines"` // 3 tiebreaker levels
	CreatorID string   `json:"creator_id,omitempty"`
	IsGlobal  bool     `json:"is_global,omitempty"`
}

CustomBoostOrderTemplate represents a named custom boost order definition.

func FindCustomOrderTemplate

func FindCustomOrderTemplate(userID string, name string) *CustomBoostOrderTemplate

FindCustomOrderTemplate searches for a template by name across user and global orders.

func GetGlobalCustomOrders

func GetGlobalCustomOrders() []CustomBoostOrderTemplate

GetGlobalCustomOrders returns all globally published custom boost order templates.

func GetUserCustomOrders

func GetUserCustomOrders(userID string) []CustomBoostOrderTemplate

GetUserCustomOrders returns all custom boost order templates saved by a user.

type CustomCriterionType

type CustomCriterionType int

CustomCriterionType enumerates the metric types in custom boost order rules.

const (
	CritDeflEffort CustomCriterionType = iota
	CritCraftDefl
	CritIHR
	CritELR
	CritTE
	CritTokens
	CritTVal
	CritDefl
	CritDeflSlot
	CritDeliv
	CritSignup
	CritReverse
	CritRandom
	CritRole
	CritArtifactCount
	CritArtifactCraft
	CritArtifactHas
	CritArtifactScore
	CritCraftingXP
	CritBoostCount
	CritGE
	CritEB
	CritSE
	CritCTE
	CritPrestige
	CritDrone
	CritEliteDrone
	CritManual
	CritTime
	CritUnknown
)

type CustomOrderSession

type CustomOrderSession struct {
	Uuid         string
	ContractHash string
	ChannelID    string
	UserID       string
	Lines        string
	ExpiresAt    int64
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DefineOrderSession

type DefineOrderSession struct {
	Uuid         string
	ContractHash string
	ChannelID    string
	UserID       string
	TemplateJson string
	IsSaved      int64
	ExpiresAt    int64
}

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 GuildRole

type GuildRole struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

GuildRole identifies the Discord role used for contract pings.

Only the ID and Name of a role are ever needed, so this holds those directly rather than embedding a library type. LocationData is persisted as JSON inside the Contract blob, and keeping a local type here means the stored shape does not change when the Discord library is updated or replaced.

The `id` and `name` JSON tags match the ones the library uses, so contracts written before this type existed still unmarshal without a data migration.

func (GuildRole) Mention

func (r GuildRole) Mention() string

Mention returns the Discord mention string for the role.

type InsertContractComplaintParams

type InsertContractComplaintParams struct {
	Contractid string
	Complaint  string
}

type InsertContractParams

type InsertContractParams struct {
	Channelid  string
	Contractid string
	Coopid     string
	Value      sql.NullString
}

type InsertContractRoleParams

type InsertContractRoleParams struct {
	Contractid string
	RoleName   string
}

type InsertMissingContractParams

type InsertMissingContractParams struct {
	Contractid string
	Timestamp  int64
}

type LocationData

type LocationData struct {
	GuildID           string
	GuildName         string
	ChannelID         string // Contract Discord ThreadID
	ChannelMention    string // Mention string for the thread
	GuildContractRole GuildRole
	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 MissingContract

type MissingContract struct {
	Contractid string
	Timestamp  int64
}

type ParsedFarmer

type ParsedFarmer struct {
	Mention string
	Guest   string
}

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 PeriodicalsRefresherFunc

type PeriodicalsRefresherFunc func(client dc.Client) bool

PeriodicalsRefresherFunc triggers an update of periodicals / contracts / events from Egg Inc API.

type PlayerScoreParameters

type PlayerScoreParameters struct {
	// contains filtered or unexported fields
}

PlayerScoreParameters holds player specific parameters for calculating scores

type PredictionInfo

type PredictionInfo struct {
	ContractID string
	Name       string
	EggName    string
}

PredictionInfo holds cached data for predicted contracts

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CountContractsByChannel

func (q *Queries) CountContractsByChannel(ctx context.Context, channelid string) (int64, error)

func (*Queries) DeleteAllContractComplaints

func (q *Queries) DeleteAllContractComplaints(ctx context.Context) error

func (*Queries) DeleteAllContractRoles

func (q *Queries) DeleteAllContractRoles(ctx context.Context) error

func (*Queries) DeleteContractByChannel

func (q *Queries) DeleteContractByChannel(ctx context.Context, channelid string) error

func (*Queries) DeleteContractComplaints

func (q *Queries) DeleteContractComplaints(ctx context.Context, contractid string) error

func (*Queries) DeleteContractRoles

func (q *Queries) DeleteContractRoles(ctx context.Context, contractid string) error

func (*Queries) DeleteMissingContract

func (q *Queries) DeleteMissingContract(ctx context.Context, contractid string) error

func (*Queries) GetActiveContracts

func (q *Queries) GetActiveContracts(ctx context.Context) ([]GetActiveContractsRow, error)

func (*Queries) GetContractByChannelID

func (q *Queries) GetContractByChannelID(ctx context.Context, channelid string) (ContractDatum, error)

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) GetMissingContracts

func (q *Queries) GetMissingContracts(ctx context.Context) ([]MissingContract, 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) InsertMissingContract

func (q *Queries) InsertMissingContract(ctx context.Context, arg InsertMissingContractParams) error

func (*Queries) UpdateContract

func (q *Queries) UpdateContract(ctx context.Context, arg UpdateContractParams) (int64, error)

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

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

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"`
	FairShare            float64   `json:"fair_share"`
	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 StatusMessagesRefresherFunc

type StatusMessagesRefresherFunc func() (int, error)

StatusMessagesRefresherFunc triggers a download and reload of status messages.

type TableImageCell

type TableImageCell struct {
	Text  string
	Color string // "green", "red", "blue", or "" (default)
}

type TableImageColumn

type TableImageColumn struct {
	Label string
	Align bottools.StringAlign
}

type TableImageRow

type TableImageRow struct {
	Cells []TableImageCell
}

type TeamworkOutputData

type TeamworkOutputData struct {
	Title   string
	Content string
}

TeamworkOutputData is a struct to hold the output data for teamwork fields

type ThematicComplaintsGeneratorFunc

type ThematicComplaintsGeneratorFunc func(eggName string, contractName string, contractDescription string, quantity int) []string

ThematicComplaintsGeneratorFunc generates contract-themed complaints.

type TokenComplaintsRefresherFunc

type TokenComplaintsRefresherFunc func() (int, error)

TokenComplaintsRefresherFunc triggers a download and reload of token complaints.

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 UpdateContractCoopIDParams

type UpdateContractCoopIDParams struct {
	Coopid     string
	Channelid  string
	Contractid string
	Coopid_2   string
}

type UpdateContractParams

type UpdateContractParams struct {
	Value      sql.NullString
	Channelid  string
	Contractid string
	Coopid     string
}

type UpdateContractStateParams

type UpdateContractStateParams struct {
	JsonReplace interface{}
	Channelid   string
	Contractid  string
	Coopid      string
}

Jump to

Keyboard shortcuts

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