# Keeping your token off Discord

A Blisscord bot token is useless on Discord, but sending it there still hands a working credential for your bot to a third party. Libraries and bot code often call Discord's hosts from places your configuration does not reach, so check before you run.

## Where Discord's hosts hide

Search your bot and its dependencies for these, and point each at Blisscord or remove it:

- `discord.com`, `discordapp.com` (REST, OAuth2, invite and message links)
- `gateway.discord.gg` (a hard-coded gateway)
- `cdn.discordapp.com`, `media.discordapp.net` (images)
- `discord.gg` (invite links)

Known cases in libraries, all covered in [Configuring your library](/docs/bots/libraries):

- **JDA** dials Discord's gateway unless its `SessionController` says otherwise.
- **serenity** sends some requests to Discord while its rate limiter is enabled.
- **discord.py** dials its built-in gateway constant when unsharded.

Your own code may do the same: an emoji sync, a dashboard login that uses a stock "Discord" OAuth provider, a deploy script with its own base URL.

## When you cannot change the code

If a dependency has Discord's hosts hard-coded and you cannot or do not want to change it, intercept them at the network level instead. This is how the team runs Zira and HepBoat on Blisscord unmodified:

1. Run a small reverse proxy (nginx works) next to the bot that answers for `discord.com`, `discordapp.com`, `gateway.discord.gg` and `cdn.discordapp.com`, and forwards to `discord.community`, `gateway.discord.community` and `cdn.discord.community`.
2. Give it a certificate for those names, signed by a private certificate authority you create.
3. Make the bot resolve those names to the proxy (for Docker, `extra_hosts`) and trust your authority (for Node.js, `NODE_EXTRA_CA_CERTS=/path/to/ca.pem`; other runtimes have their own trust store setting).

Nothing then leaves for Discord, whatever the code does.

## If a token did reach Discord

Reset it on the application's Bot page in the [developer portal](https://developers.discord.community). The old token stops working at once.
