feat(wm): /wm profile — KBVE username + wallet balance (read-only, ephemeral) - #14312
Open
h0lybyte wants to merge 2 commits into
Open
feat(wm): /wm profile — KBVE username + wallet balance (read-only, ephemeral)#14312h0lybyte wants to merge 2 commits into
h0lybyte wants to merge 2 commits into
Conversation
Adds an ephemeral /wm profile command showing the invoking Discord user's linked KBVE username, credits (USD-pegged) and khash balance. - Migration public.proxy_discord_profile(discord_id): one service-role PostgREST RPC joining tracker.find_claim_identity_by_discord_id + wallet.service_user_balance, keeping both schemas private. - f/shared/profile.ts core: PostgREST read with a best-effort short-TTL Valkey cache in front (graceful — absent/failed cache falls through to DB). - f/discordsh/profile.ts surface: ephemeral embed; unlinked users get a link-your-account prompt. Read-only — spending is a later phase. - Bot honors a top-level ephemeral flag in the result → private, no reroll. Bump 0.1.28. Prereqs to go live in commit body / PR.
Discord locks response visibility at defer time, so the script's ephemeral flag alone rendered the wallet embed publicly. Known-private command leaves now defer_ephemeral before the script runs. creditsToUsd divided by 100_000; peg is $1 = 1,000,000 credits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New
/wm profile— an ephemeral embed showing the invoking Discord user's linked KBVE username, credits (USD-pegged) and khash balance. Read-only preview; spending is a later phase. First step of the profile/credits-on-Discord prep.Pieces
public.proxy_discord_profile(p_discord_id text)— one service-role PostgREST RPC that joinstracker.find_claim_identity_by_discord_id(Discord→KBVE link) +wallet.service_user_balance(credits/khash), so the bot reads profile+balance in a single HTTP call while both source schemas stay private.linked=false+ zero balances for unlinked snowflakes.f/shared/profile.ts— PostgREST read with a best-effort short-TTL (60s) Valkey cache in front. Graceful: absent client / miss / any error falls through to the DB, so the cache is never load-bearing. Uses Bun's native redis client (zero-dep).f/discordsh/profile.ts— ephemeral embed (username, credits $ + raw, khash). Unlinked users get a "sign in with Discord at kbve.com" prompt.ephemeral: truein a script result → keeps the reply invoker-only and drops the public reroll button. Extends the embed contract without touching existing commands.Privacy
Balances are ephemeral (only the invoker sees them) — the opposite of the now-public reroll embeds. That's why the contract flag exists.
f/discordsh/kbve_supabaseresource →{ url, service_key }(service_role key).f/discordsh/valkey_urlvariable → Valkey connection URL (optional; blank = cache disabled, still works).Scripts sync via windmill-sync on merge to main; order: migration → resources → scripts/bot.
Verified
cargo buildclean; both TS scriptsbun buildclean.Follow-up (tracked): spending (debit RPCs,
/wmspend), optional footer balance on other embeds, confirm Bun redis client version in the Windmill runtime.