Skip to content

Run context

run receives ctx. Calls that change something (ban, rcon, note, fetch) are the module’s actions; ctx.player holds lazy reads.

Member Signature Meaning
at readonly at: string The moment the run started, as an ISO 8601 string.
ban ban: (request: BanArguments) => Promise<ActionResult> Bans the subject player. “for” is a duration such as 1h or “permanent”; “servers” chooses all servers or only the current one.
counter readonly counter: CountersOf<H> Values of the counters declared in the header “counters”, computed before the run starts.
event readonly event: EventFields Fields of the event that started the run, named by the game vocabulary. Empty for buttons and schedules.
fetch fetch: (url: string, init?: FetchInit) => Promise<FetchResult> Sends an HTTP request and returns the answer: status, headers and body as text. Any status, including 4xx and 5xx, comes back as an answer with ok true; ok false and the error mean the platform refused the call (private network, time, size, too many redirects, secret not allowed for host). Method, headers and body are set by the module.
input readonly input: InputsOf<H> Values the operator entered for the fields declared in the header “inputs”. Optional fields are undefined when left empty.
note note: (body: string) => Promise<ActionResult> Adds a note to the subject player.
player readonly player: PlayerNow & PlayerReads The subject player: id and known facts such as name, plus lazy reads. A read makes one query the first time it is awaited; repeated reads are cached until the module performs an action.
rcon rcon: (command: string) => Promise<ActionResult> Sends one RCON command to the server the run belongs to. AdminKick and AdminKickById count against the kick limit.
secret secret: (name: string) => string Returns a label for an organization secret; put it into fetch headers or body: the platform replaces it with the value only for https requests to the secret’s hosts, otherwise the fetch is refused. The value is never visible to the module.
server readonly server: ServerNow Facts about the server the run belongs to, such as name, players and layer. A fact that could not be read is absent.
user `readonly user: ActingUser null`

Each read is an async function that makes one query the first time it is awaited, so a module that never calls it pays nothing. Repeated reads are cached until the module performs an action. All values come back as strings.

Call Meaning Cost
ctx.player.accessLists() Names of the access lists the player is on, comma-separated. one query the first time, cached until the next action
ctx.player.account() The player account the in-game identity is linked to. one query the first time, cached until the next action
ctx.player.altsBanned() How many alternate accounts of the player are banned. one query the first time, cached until the next action
ctx.player.altsCount() How many alternate accounts are linked to the player. one query the first time, cached until the next action
ctx.player.bansCount() How many bans the player has in this organization. one query the first time, cached until the next action
ctx.player.cblActiveBans() Active bans on the player in the Community Ban List. one query the first time, cached until the next action
ctx.player.cblRisk() Community Ban List risk rating of the player. one query the first time, cached until the next action
ctx.player.country() Country of the latest connection. one query the first time, cached until the next action
ctx.player.discord() Whether a Discord account is linked to the player. one query the first time, cached until the next action
ctx.player.discordRoles() Discord roles of the linked account, comma-separated. one query the first time, cached until the next action
ctx.player.exception() Whether the player has a ban exception. one query the first time, cached until the next action
ctx.player.firstSeen() When the player was first seen on any server of the organization. one query the first time, cached until the next action
ctx.player.gameTimePlayed() Hours the player has played in the game, as reported by the platform. one query the first time, cached until the next action
ctx.player.lastSeen() When the player last joined a server. one query the first time, cached until the next action
ctx.player.notesCount() How many notes the player has. one query the first time, cached until the next action
ctx.player.patronPaidUntil() Date until which the linked Patreon pledge is paid. one query the first time, cached until the next action
ctx.player.patronStatus() Status of the linked Patreon pledge. one query the first time, cached until the next action
ctx.player.patronTiers() Patreon tiers of the player, comma-separated. one query the first time, cached until the next action
ctx.player.seedDays() Number of distinct days the player took part in seeding. one query the first time, cached until the next action
ctx.player.seedExcluded() Whether the player is excluded from seeding rewards. one query the first time, cached until the next action
ctx.player.seedMinutes() Minutes the player spent seeding. one query the first time, cached until the next action
ctx.player.sessionMinutes() Minutes of the current session. one query the first time, cached until the next action
ctx.player.steamAccountAgeDays() Age of the Steam account in days. one query the first time, cached until the next action
ctx.player.steamDaysSinceLastBan() Days since the last Steam-side ban. one query the first time, cached until the next action
ctx.player.steamGameBans() Number of game bans on the Steam account. one query the first time, cached until the next action
ctx.player.steamHours() Hours of the game on the Steam account. one query the first time, cached until the next action
ctx.player.steamVacBans() Number of VAC bans on the Steam account. one query the first time, cached until the next action
ctx.player.tags() Tags of the player, comma-separated. one query the first time, cached until the next action