BuildSDK 0.10.1

Ephemeral state

These docs are public. To publish a plugin you need a YourBot account: sign in to open the Dev Portal.

Backed by Redis — fast counters, dedup, cooldowns, and short-lived flags. Don't use this for anything you need durably (eviction policy is LRU under memory pressure). No capability required.

Counters

n = ctx.ephemeral.counter("ratelimit:user:42", window_seconds=60)
if n > 5:
    ctx.interaction.respond(content="Slow down!", ephemeral=True)
    return

Cooldowns

state = ctx.ephemeral.cooldown_check("daily:user:42")
if state["active"]:
    ctx.interaction.respond(
        content=f"Try again in {int(state['remaining_seconds'])}s",
        ephemeral=True,
    )
    return
ctx.ephemeral.cooldown_set("daily:user:42", ttl_seconds=86400)

Dedup & flags

# dedup: returns True the FIRST time a key is seen, False afterwards
if not ctx.ephemeral.dedup(f"welcome:{event['user_id']}", ttl_seconds=3600):
    return  # already welcomed this user in the last hour

ctx.ephemeral.flag_set("event:black_friday", ttl_seconds=86400)
if ctx.ephemeral.flag_check("event:black_friday"):
    ...

Limits: keys up to 256 chars, max TTL 24 hours (TTLs above 86400s are silently clamped). Reads are free; writes draw from your 60 outbound actions/min budget at 0.1 each, so roughly 600 ephemeral writes/min if you do nothing else. State is namespaced per (plugin, server): like KV, nothing is shared across servers, so a flag set on server A is invisible on server B. See Limits and quotas.

YourBot docs Reference tables are generated from the code that is running. Ask in Discord Suggest a correction