Browse API 1 documentation
GroveAPI 1preview

grove.memberBadges.set()

Replace native badges beside channel members.

Mango 3.1+View Markdown

Replace native badges beside channel members.

Signature

ts
grove.memberBadges.set(badges: {
  id: string; channelKey: string; memberKey: string;
  icon?: string; text?: string; tooltip?: string
  color?: 'neutral' | 'accent' | 'success' | 'warning' | 'danger'
}[]): void

Availability

Server-scoped runtimes with ui.member-badges. Reading authoritative target data requires the corresponding channel.members or channel.metadata capability separately.

Parameters

Parameter Required Description
badges Yes Full replacement array; [] clears all.
id Yes Local badge identity per target; trimmed/lowercased, capped at 64 characters, nonempty.
channelKey Yes Host-canonical channel key; nonempty, at most 200 UTF-8 bytes.
memberKey Yes Host-canonical member key; nonempty, at most 200 UTF-8 bytes.
icon At least icon or text SF Symbol name, single-line and capped at 64 characters.
text At least icon or text Single-line label, capped at 32 characters.
tooltip No Single-line explanation, capped at 120 characters.
color No Semantic tint, default neutral; unknown values use neutral.

Return value

Returns undefined; no validation report or list is returned.

Behavior and errors

The call replaces the whole list atomically. Mango retains at most two badges per target per instance and 8,192 total, inspecting at most 32,768 candidates. Duplicate target/id entries keep the first. Empty/unrenderable entries are omitted. Use canonical keys from snapshots instead of lowercasing display names yourself. Rendering requires the target to exist; registrations grant no access to a missing roster. Mango provides attribution and removes contributions when the instance stops.

Example

js
grove.on('channelSnapshots', ({ channels }) => {
  grove.memberBadges.set(channels.flatMap(channel => (channel.members || []).map(member => ({
    id: 'mode', channelKey: channel.channelKey, memberKey: member.memberKey,
    text: member.prefixes || 'member', color: 'neutral'
  }))))
})

See Event reference.