Skip to main content

DiscordLab for SCP:SL with HTTP Proxy Support

On servers where access to Discord is restricted, DiscordLab may successfully send HTTP requests through the proxy while failing to connect to the Discord Gateway. The bot then remains offline even though proxy_url is configured correctly.

This guide provides a temporary compatibility build for DiscordLab 2.6.1. It uses a different WebSocket implementation and explicitly negotiates a modern TLS connection through the HTTP proxy.

Temporary compatibility build

This is not an official DiscordLab release. Back up the original DiscordLab.Bot.dll before replacing it. Use this build only for DiscordLab 2.6.1 and switch back to an official release when the upstream project resolves the issue.

Before you begin

You need an installed and configured DiscordLab plugin. If you are installing it for the first time, follow the official DiscordLab installation guide first.

In the DiscordLab configuration, make sure your proxy is specified in URL form:

proxy_url: 'http://HOST:PORT/'

Do not publish your bot token or proxy credentials.

Install the compatibility build

  1. Stop the SCP: Secret Laboratory server.
  2. Open LabAPI/plugins/global and rename the existing DiscordLab.Bot.dll to DiscordLab.Bot.dll.backup.
  3. Download DiscordLab.Bot.dll and upload it to LabAPI/plugins/global.
  4. Download websocket-sharp.dll and upload it to LabAPI/dependencies/global.
  5. Start the server and check the console.

The resulting layout should look like this:

LabAPI/
├── plugins/
│ └── global/
│ └── DiscordLab.Bot.dll
└── dependencies/
└── global/
└── websocket-sharp.dll
Control-panel installations

The LabAPI data folder is usually inside .config/SCP Secret Laboratory/. The exact root path may differ between hosting panels, but the plugins/global and dependencies/global folders remain the same.

Enable Discord Gateway intents

After the WebSocket connection is fixed, Discord can close it with error 4014 if the bot requests privileged intents that are disabled for the application.

  1. Open the Discord Developer Portal.
  2. Select your application and open Bot.
  3. Under Privileged Gateway Intents, enable:
    • Presence Intent;
    • Server Members Intent;
    • Message Content Intent.
  4. Save the changes and restart the SCP:SL server.

DiscordLab 2.6.1 requests all gateway intents, so all three privileged intents are required. Discord documents close code 4014 as an attempt to use a disallowed intent in its Gateway status codes.

Verify the connection

A successful proxy handshake includes a response similar to:

HTTP/1.1 101 Switching Protocols
Connection: upgrade

The bot should then appear online in Discord. If you enabled debug: true while troubleshooting, change it back to false after confirming that everything works.

Troubleshooting

The plugin cannot load websocket-sharp

If the console shows Could not load file or assembly 'websocket-sharp', verify that websocket-sharp.dll is in LabAPI/dependencies/global, not in the plugin folder, and restart the server.

The WebSocket remains closed

Check that:

  • proxy_url starts with http:// and includes the correct host and port;
  • the proxy supports the HTTP CONNECT method to gateway.discord.gg:443;
  • both replacement DLL files from this page are installed;
  • the server was fully restarted after replacing the files.

Error 4014 appears

Enable all three privileged gateway intents in the Discord Developer Portal. Bot permissions on a Discord server and gateway intents are separate settings; granting the bot Administrator permission does not enable these intents.

The server worked once and then stopped

Restore the compatibility build and check whether DiscordLab's auto_update option replaced it with the official DLL. While using this temporary build, set:

auto_update: false

When a compatible official DiscordLab release becomes available, restore normal updates and remove the temporary websocket-sharp.dll dependency if the official release does not require it.

Roll back

  1. Stop the server.
  2. Remove the replacement DiscordLab.Bot.dll.
  3. Rename DiscordLab.Bot.dll.backup back to DiscordLab.Bot.dll.
  4. Remove websocket-sharp.dll only if no other plugin uses it.
  5. Start the server.