CEEJAYDocs

ceejay.community

Look up which community a key belongs to, what the key can do, and which features this instance supports.

The function takes the same last argument as every other, options: signal, timeoutMs and maxRetries, for that one call. It can also raise the errors any request can raise, such as a bad key or the rate limit. Both are on Errors and retries.

ceejay.community.get

Gets the community of the key, the key's permissions and rate limit, and which features this community can use. Make it your first call: it tells you immediately whether the key works, and what to expect from every other function.

GET /v1/community · any valid key · API reference: Community details

Retried by the SDK: Yes. It is a read

Takes options only.

Returns Schemas['Community'].

Prop

Type

features has eleven entries. Each has available, and two have one more field:

EntryThe functions it is aboutOne more field
xpxp.getBalance, xp.grant, xp.deduct
economyThe three under economyenabled: whether the community's economy is switched on. While it is off, quests.complete does not grant a quest's coins. economy.grant and economy.deduct work either way
questsThe three under questsdailyQuestLimit: how many quests a member can complete in one day, which quests.complete applies
programsprograms.list, xp.program.grant, xp.program.deduct
linkingmembers.link
rolesThe three under roles
messageschannels.list, messages.send
eventsevents.emit
shopDeliveryThe two under shop
retryKeysidempotencyKey on every write
playersThe five under connect, and what CeejayConnect sends from a game. Connect is enabled per instance, so this also reads false where it is not enabled

What a function returns while its entry reads available: false is described under A feature this instance does not support yet.

Errors

This request has no errors of its own and needs no permission, so it cannot return insufficient_scope.

Example

ceejay.community.get
const community = await ceejay.community.get()

console.log(`${community.name} (${community.serverId}), API ${community.apiVersion}`)
console.log(`This key: ${community.key.scopes.join(', ')}, ${community.key.rateLimitPerMinute} requests a minute`)

if (!community.features.retryKeys.available) {
  console.log('This instance does not support idempotency keys yet')
}
if (community.features.economy.available && !community.features.economy.enabled) {
  console.log('The economy is switched off: a quest pays no coins')
}
for (const platform of community.platforms.custom) {
  console.log(platform.slug, platform.name)
}

A feature this instance does not support yet

An instance is updated in stages, so for a short time after an update a community can lack what a function needs. features reports this before you call.

Entry that reads available: falseWhat its functions return
economy, quests, programs, linking, events, shopDelivery, playersStatus 404 with the code not_available. error.body.feature names the entry
roles, messagesStatus 500 with the code discord_not_configured
retryKeysA write sent with idempotencyKey is rejected with status 503 and the code idempotency_unavailable. The same write without a key works

A call rejected this way changes nothing, and waiting does not change the response: contact support to complete the update.

On this page

Community StudiosPrivacyTerms