# Configuring your library

Every library below has been run against Blisscord. Each needs the REST base moved to `https://discord.community`; most then learn the gateway address from `GET /gateway/bot`, which answers `wss://gateway.discord.community`. Where a library does not ask, it is set explicitly below.

## discord.js (v14)

```js
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
  rest: {
    api: 'https://discord.community/api',
    cdn: 'https://cdn.discord.community',
  },
});

client.login(process.env.TOKEN);
```

The gateway URL comes from `GET /gateway/bot`, so nothing else is needed. For `@discordjs/rest` on its own (for example a command deploy script), pass the same option: `new REST({ api: 'https://discord.community/api' })`. Verified with 14.27.

## discord.py (2.x)

```py
import discord
import yarl

discord.http.Route.BASE = "https://discord.community/api/v10"
discord.gateway.DiscordWebSocket.DEFAULT_GATEWAY = yarl.URL("wss://gateway.discord.community/")
discord.asset.Asset.BASE = "https://cdn.discord.community"

client = discord.Client(intents=discord.Intents.default())
client.run(TOKEN)
```

Set these before the client is created. An unsharded discord.py client dials `DEFAULT_GATEWAY` rather than asking `/gateway/bot`, so the second line is required. Verified with 2.7.1.

## JDA (5 and 6)

```java
JDA jda = JDABuilder.createDefault(token)
    .setRestConfig(new RestConfig().setBaseUrl("https://discord.community/api/v10/"))
    .setSessionController(new SessionControllerAdapter() {
        @Override
        public String getGateway() {
            return "wss://gateway.discord.community/";
        }
    })
    .build();
```

`setBaseUrl` moves REST only. JDA's gateway address comes from `SessionController.getGateway()`, which is hard-coded to Discord's gateway, so the override is required: without it JDA sends your token to Discord's gateway. JDA builds CDN links on `cdn.discordapp.com` itself. Verified with 6.7.0.

## serenity (0.12)

```rust
let http = HttpBuilder::new(&token)
    .proxy("https://discord.community")
    .ratelimiter_disabled(true)
    .build();

let mut client = ClientBuilder::new_with_http(http, intents)
    .event_handler(Handler)
    .await?;
```

serenity ignores `proxy` while its client-side rate limiter is on (the limiter builds its requests without it, and `GET /gateway` went to Discord), so it has to be disabled; your bot then receives a 429 instead of being slowed down, so keep request volume modest or retry on 429. Verified with 0.12.5.

## Eris and Athena

```js
const client = new Eris.Client(`Bot ${token}`, {
  intents: ['guilds', 'guildMessages'],
  rest: { domain: 'discord.community', https: true },
});
```

`rest.domain` is a bare host name, not a URL. The gateway URL comes from `GET /gateway/bot`. Athena (Team Hydra's Eris fork) takes the same option; verified with Athena 4.6 and with Zira and HepBoat in production configuration.

## Lavalink and other voice clients

Nothing to configure. A voice client connects to whatever endpoint `VOICE_SERVER_UPDATE` names, which is Blisscord's voice server. Verified with Lavalink 4.2.2 (Zira Music). See the voice notes in [Differences from Discord](/docs/bots/differences).

## HTTP interactions

An application can receive interactions as signed HTTP POSTs to an Interactions Endpoint URL, set on the application's page in the portal, exactly as on Discord. Requests are signed with the application's Ed25519 key, shown in the portal as the public key, so `discord-interactions` and similar verifiers work unchanged. The URL must answer the verification PING before it is saved.

## Anything else

For any other library or raw HTTP and WebSocket code, change three things:

1. The REST base: `https://discord.com/api` becomes `https://discord.community/api` (keep the version segment you use).
2. The gateway: use the `url` from `GET /gateway/bot`, or `wss://gateway.discord.community` if the library hard-codes one. JSON and ETF encodings, and `zlib-stream` and `zstd-stream` compression, are supported.
3. The CDN: `https://cdn.discordapp.com` becomes `https://cdn.discord.community`.

Then read [Keeping your token off Discord](/docs/bots/keeping-tokens-safe): libraries often call Discord's hosts from somewhere you did not configure.
