Discovery
Point a Client at a self-hosted instance with Client.fromDiscovery.
This page is instance discovery (where the API lives). Listing a guild in the public server directory is Server Discovery. Bots cannot join a guild via discovery.
Hosted Fluxer works with a normal new Client(). Self-hosted instances expose unversioned GET /.well-known/fluxer on the origin you were given (hosted: https://fluxer.app/.well-known/fluxer). Client.fromDiscovery loads that document and wires REST from endpoints.api_public. First-party endpoints.api / api_client stay on the instance for inspection.
Bootstrap from an origin
Pass the Fluxer origin, not {api}/v1/.well-known/fluxer. Discovery is unversioned.
import { Client, Events } from '@fluxerjs/core';
const client = await Client.fromDiscovery('https://my.instance');
client.on(Events.Ready, () => {
console.log(client.instance.endpoints.api_public);
console.log(client.instance.endpoints.api);
});
await client.login(process.env.SELFHOST_BOT_TOKEN);Hosted discovery is the same pattern with https://fluxer.app. Use a token issued by that instance. Hosted and self-hosted tokens are not interchangeable.
fromDiscovery does not log in. Call login afterward.
REST uses api_public
A third-party client (bots, this SDK) MUST use endpoints.api_public. On hosted Fluxer that is https://api.fluxer.app. endpoints.api and endpoints.api_client are the first-party web endpoint (https://web.fluxer.app/api on hosted) and are not interchangeable with api_public.
console.log(client.rest.baseUrl);
// hosted: https://api.fluxer.app/v1Inspect the instance
const doc = await client.fetchInstance();
console.log(doc);fetchInstance also uses the unversioned well-known path (no /v1). Or read what discovery already applied:
console.log(client.instance.endpoints);
console.log(client.instance.discovery?.features);Locale
Error message text is localised from Accept-Language when the request has no stored user locale. The SDK sends en-US by default. Override with ClientOptions.locale or rest.locale:
const client = new Client({ locale: 'de' });Multiple instances
One Client equals one Fluxer instance. To run hosted and self-hosted together, use beta ClientCluster (see Multi-instance and multi-instance-bot).
Prefer discovery over rest.api
ClientOptions.rest.api can override the public API host for legacy setups. For self-hosted media/CDN/invite hosts, discovery is the better path so you do not leave CDN URLs pointing at hosted defaults.