-
Notifications
You must be signed in to change notification settings - Fork 116
Building
For the time being, you'll have to build BDv2 locally by yourself.
- Node.js v6 or later
- libsecret if using Linux
Follow these instructions if you want to test how BDv2 would run when it's released to the public, it's also preferred to use this when you're developing a theme or a plugin.
This will also generate a zip archive for the installer.
- Clone the repository.
- Run
npm install
andnpm run release
in the root folder.
This will delete therelease
directory, including any user data, rebuild it and copy thenode-sass
andkeytar
bindings. - Download the emote data and extract the contents to
release/data
.
You can skip this step if you don't want to see emotes. - Modify Discord to load BetterDiscord.
To rebuild the release, run npx gulp build-release
.
Follow these instructions if you're going to set up a development environment for BDv2.
- Clone the repository.
- Run
npm install
andnpm run build
in the root folder. - Download the emote data and extract the contents to
tests/data
.
You can skip this step if you don't want to see emotes. - Modify Discord to load BetterDiscord.
To rebuild all, run npm run build
.
To watch the core, run npm run watch_core
.
To watch the client, run npm run watch_client
.
To watch the CSS editor, run npm run watch_csseditor
.
Core rebuilds requires a full Discord restart, while client and CSS editor can be reloaded by pressing Ctrl/Cmd + R
.
There's 3 ways that you can take, the first one by using the inject script and the second and third one being manual injection.
Run npm run inject
in the root folder.
If you want to install to other release channels like PTB and Canary, you can run npm run inject ptb
or npm run inject canary
.
The script injects the same way as the instructions below for injecting through resources.
-
Navigate to the resources folder and create a new folder called
app
.This is usually located at:
- for Windows,
%localappdata%\Discord\app-<version>\resources
- for macOS,
/Applications/Discord.app/Contents/Resources
- for Linux,
/usr/share/discord/resources
- for Windows,
-
Inside the folder, create the following files:
-
package.json
{ "name": "betterdiscord", "description": "BetterDiscord", "main": "index.js", "private": true, "dependencies": {} }
-
index.js
const path = require('path'); const Module = require('module'); const electron = require('electron'); const basePath = path.join(__dirname, '..', 'app.asar'); electron.app.getAppPath = () => basePath; Module._load(basePath, null, true); electron.app.on('ready', () => new (require('path-to-bd').BetterDiscord)());
-
Edit discord_desktop_core/index.js
to contain the following.
new (require('path-to-bd').BetterDiscord)();
module.exports = require('./core.asar');
This is usually located at
- for Windows,
%appdata%\discord[channel]\<version>\modules\discord_desktop_core\index.js
- for macOS,
~/Library/Application Support/discord[channel]/<version>/modules/discord_desktop_core/index.js
- for Linux,
~/.config/discord[channel]/<version>/modules/discord_desktop_core/index.js