Making Discord better with BetterDiscord (Now works for 0.0.11!)

:memo: This current revision of the guide on 02/05/2020 intends to shorten the guide while integrating my new presentation style. As such, it may appear different from when you had last read it, but the content is still the same.

:ubuntu_mate: Introduction

My previous efforts at installing BetterDiscord is a trainwreck. Because of this I finally got around to investigating how to make it work, and a user by the name of Observer of Time made possible the means to install BetterDiscord. This will resolve every single one of your issues with installing it on Ubuntu and other open-source systems. This will work guaranteed (at least in a live session).

:question: Why even?

If you are completely unaware of what BetterDiscord is, then the gist of what BetterDiscord provides for Discord's desktop client is the capability to customize how it works and appears with third-party javascript and CSS.

This provides the means to install additional utilities as plugins for ease-of-use and modify its appearance with themes which can help to enhance your Discord experience by skinning the client to match with a system theme or other preferred appearance.

:install: Installing the installer

:information_source: You should have installed Discord and run it the first time before performing any of this. Be sure you quit Discord before following the details below.

This is pretty straight-forward. You can use a variety of means to install it here but if you're on Cosmic, you will have to do some tinkering when using add-apt-repository. As follows;

:heavy_dollar_sign: In x-terminal-emulator:
Replace pluma with your preference if desired.

sudo pluma '/etc/apt/sources.list.d/chronobserver-ubuntu-betterdiscordctl-*.list'

Then paste the following;

:spiral_notepad: In pluma or your text editor of preference:
Replace with

deb http://ppa.launchpad.net/chronobserver/betterdiscordctl/ubuntu bionic main
# deb-src http://ppa.launchpad.net/chronobserver/betterdiscordctl/ubuntu bionic main

Once you've saved the changes as shown above:

:heavy_dollar_sign: In x-terminal-emulator:

sudo apt update

After apt completes its task, you can then proceed with next steps for installing Bandaged BetterDiscord, the fork of BetterDiscord maintained by Zerebos and which had become the "Official" version of BetterDiscord v1.

:tada: Making Discord better

:open_file_folder: Directory issues

Before you begin, you have to do this first since betterdiscordctl doesn't do this automatically (subject to change):

:heavy_dollar_sign: In x-terminal-emulator:

mkdir ~/.config/BetterDiscord

:mag: Yes, case does matter, for you Linux initiates trying to do this.

:harddrive: Committing performance

After creating the directory BetterDiscord needs to see for population, you can then perform the following for a very verbose installation procedure:

:heavy_dollar_sign: In x-terminal-emulator:
See notes below for how to complete the command shown.:dagger:

betterdiscordctl install -v -v -d /usr/share/discord -m ~/.config/discord/<version>/modules

Once finished, it will say so.

:dagger: Resolution for installation issues

If encountering problems with the command above, consider the following:

  • Does Discord install to /usr/share/discord?
    To check this, perform ls /usr/share and see if Discord is there. If not, then find where the executable binary for Discord is on your system and use that for path.
  • Of <version>; Finding the correct directory path
    To check this, perform ls ~/.config/discord. The top-most directory shown should be of a numeric value. As of this writing it is 0.0.9 but this is always subject to change.
    This will not appear if you do not run Discord the first time!

:gear: Now that it's working...

When running it for the first time, you might be flummoxed about what plugins and themes are available. There are a couple of plugins which help with that, which you can put into ~/.config/BetterDiscord/plugins:

  • Plugin repo for finding awesome add-ons which either append onto existing functions or add new capabilities into the client.:crossed_swords:
  • Theme repo for changing the appearance of the Discord desktop client into anything you could possibly imagine, by finding and appending onto solid bases to further change via CSS how Discord looks and feels.:crossed_swords:

:crossed_swords: Disclaimer of intention

Some plugins are dependent of other plugins. Some "Themes" may intend to enhance functionality of the desktop client and / or themes similarly to plugins. Some extensive themes may interfere with the functionality of other, less extensive or special-purpose themes. Not all themes support popular plugins. As an end-user, you agree to perform modifications as necessary so all software provided therein work together, or make a "Best effort" to request software authors support other works.

:grey_question: Need further help?

Check here for a support server which should answer a fair majority of your questions regarding errors and issues with using BetterDiscord. Be warned; the culture within BetterDiscord's development team is more on the acidic side, so be prepared for snark and smart-alec commentary if you present yourself as a complete and total noob.

:x: Don't read this.

Here lies old stuff. A lot of this doesn't apply anymore and exists for legacy purposes. ### If you're lazy and wish for the below to be automated, [url=https://raw.githubusercontent.com/Hebgbs/Hebgbs.github.io/master/betterdiscordoneshot.sh]_right-click_ here.[/url] _Save Link As_ a `.sh` file where you keep your Git stuff, `chmod +x` it and execute it _by itself_.

Did the above go over your head? That's alright. Assuming some things, and if you find the terminal easier to deal with, repurpose this example for your local filesystem;

mkdir -p ~/git
cd ~/git
wget https://raw.githubusercontent.com/Hebgbs/Hebgbs.github.io/master/betterdiscordoneshot.sh -O ./betterdiscordoneshot.sh
sudo chmod +x betterdiscordoneshot.sh
./betterdiscordoneshot.sh

Lastly, if you still want Discord Canary, you can edit this script to install that instead of the build that is publicly available. BetterDiscord works on both, the only difference is Canary users get features to-be-implemented sooner. Simply follow the comments in the script to make it install Discord Canary instead.

If you don't know already what Discord is, crawl out from under the rock you've been living at and check it out. Else, if you've been using Discord for some time, you might had caught wind, and even use an enhancement for the desktop version of Discord called BetterDiscord. Previously you had to use the Canary build on Linux but those dark days are over; Discord is officially released for Linux and is accessible from its downloads page.

Note; These instructions are specific for Ubuntu derivatives, this guide should not be considered as a generic Linux guide for any distribution: these instructions may need to be modified for use elsewhere.

Installation

It's not quite as easy to install BetterDiscord on Linux as it is on Windows, since there's a bit of requisite software that needs to be set up first. Dealing with this first will ensure a smoother experience later;

Requisite software

Discord, obviously.
sudo apt install -y git npm # Git and Node Package Manager sudo npm install -g n # Install the Node version control helper sudo n stable # Use the latest stable version of node.js
Node is very weird and I had a tough time trying to explain the above. Nonetheless it's required.

mkdir -p ~/git && cd ~/git # Optional; Keep your tree tidy! git clone https://github.com/jiiks/betterdiscordapp cd betterdiscordapp/Installers/Electron # More things need to be done here first

Expand this to read about script stuffJiiks merged a fix for `src/installer_index.js` inside `betterdiscordapp/Installers/Electron` but my script _previously_ deleted `installer_index.js` and grabbed Leeo97one's commit which resolved the Electron installer issue previously making installation of BetterDiscord in 0.0.1x impossible. That's been removed now.

`npm install # Get version 1.2.8 of Electron
npm install --save-dev electron # As from Electron's website; grab the latest version of Electron (1.4.1 as of 10/13/16)

Save yourself from having to make folders later; the below will assume these paths

mkdir -p ~/.config/betterdiscord # Where essential files will later resideAlternatively you can skip making this and use the installer's default path; Just remember to replace any instance of the path above with this:/usr/local/share/BetterDiscord mkdir -p ~/.BetterDiscord # Where user-modifiable stuff will later reside`

Installing BetterDiscord

With all of that out of the way, you can now install BetterDiscord with the following command;
sudo ./node_modules/.bin/electron ./src

At the installer, you're presented with some stuff you need to click through. Here's where you'll end up;

Use the following information below; Paths are what had been assumed above with the mkdir commands earlier, else modify to preference;

  • For the purposes of making BetterDiscord fit in a bit more with other Debian / Ubuntu software, put BetterDiscord into ~/.config/betterdiscord (browse to it)
  • Discord resides in /usr/share/discord

A couple more things need to be done, after this, everything is finished;

  • BetterDiscord will look for stuff in /var/local/BetterDiscord; do this to make it fit in better:
    sudo ln -s ~/.BetterDiscord /var/local/BetterDiscord
  • Make utils.js usable (Discord wil not run otherwise);
    cd ~/.config/betterdiscord/BetterDiscordApp-stable16/lib sudo mv Utils.js utils.js
  • Alternatively, instead of mv, ln -s Utils.js utils.js can be done; same difference.

Finally, run discord and enjoy an improved Discord experience. From BetterDiscord's homepage you can check out the GitHub link and find your way into the BetterDiscord guild that way, or any time during use of BetterDiscord, click on the links that will send you to that guild's # support text channel.

1 Like

Man, that was a trip! Took me an hour to get Discord working again, and even more time to debug and publish my newly-updated automation script but I believe it was worth it for the few users of Discord who would be interested in not just installing it, but enhancing their experience with themes and plugins.

I know at least one person will enjoy it.

Betterdiscord's installation finishes here for me. I had to close the window because it was taking too much time. Couldn't run Discord afterwards and reinsalling doesn't solve the issue. Please help.

The Electron installer does not exit gracefully. Did you use the automated script or do things yourself?

There is a file you have to change its name of in ~/.config/betterdiscord/BetterDiscordApp-stable16/lib called `Utils.js which needs to be lowercase. I will reboot into a Linux session and see if any of the foldernames had changed just to be sure.

Quick edit; I was incorrect in some steps, but also the BetterDiscord installer defines its own paths nowdays. If you just went through the motions and clicked next to everything, BetterDiscord stuff will be in /usr/local/share/BetterDiscord. If you screwed up at the Utils.js step, it must be done sudo, sorry there. If there were any issues with the installer, then delete the Git directory you cloned and try again, double-checking yourself. If it was an issue with my script, paths required are hardcoded; the ā€œThings to doā€ bit which is prompted in the script prior to the BD installer running shows those paths for a reason.

Another quick edit: Fixed it. BetterDiscord works for me, except it did error out with bdStorage being an issue. I am going to edit my script to resolve that.

One more time; This is an additional step in my script;

cd /var/local/BetterDiscord
sudo mv bdstorage.json bdStorage.json

Sorry butā€¦ I didnā€™t get it through. What do I have to do exactly right now?

Apologies for replying laate, I figured you would resolve the problem on your own. The code I posted in my comment prior is the answer if you have come so far to launch Discord, but then get that odd JS exception and BetterDiscordā€™s prompt about bdStorage.

The BetterDiscord installer does one thing wrong every revision, Iā€™ve found. The thing that is wrong this time aside from utils.js being messed up is bdStorage.js. Both files load with one letter that is the opposite of trhe case it is suppose to be becuse most Linux filesystems are case-sensitive.

Hereā€™s everything you need to do to hopefully make BetterDiscord work if you had used my script previously beecause some things did suck about it;

cd ~/.config/betterdiscord #If this doesn't exist, go to where you chose to install BetterDiscord
sudo mv Utils.js utils.js
cd /var/local/BetterDiscord
sudo mv bdstorage.json bdStorage.json 

Then do a locate for it, piping it to less in case you have a huge list of these files;
locate Utils.js | less

Do the same for bdstorage. From what you had shown me, if you went through the motions you should look for Utils.js in /usr/local/share/BetterDiscord had you blindly clicked next to everything.

Did you ever resolve your problem? Sorry to be the one asking for a follow-up, and sorry your first experience with this software had to be a negative one.

If you want to try again in a live session of the system, you can make sure the new version of my script is working fine before trying this again, but honestly we have to fault Jiiks for having the Electron installer add two files that do not have the appropriate case to them.

Hopefully whenever he does ā€œVersion 2ā€ of this software he can make an installer that sucks less, and maybe one users donā€™t have to compile on their system. I see no reason why the installer couldnā€™t had been compiled for the end-user beforehand.

mkay, so everything works up to here:

the installer does not pop up at all
(sorry, I'm actually using Fedora 25 but this was the only way I could find to installing it)
do you have any ideas to fixing it?

Is Node Package Manager installed?

You certainly shouldnā€™t use my script because itā€™s for Debian systems only but you should be able to manage with Fedora on your own.

yeah npm is installed
ok, thanks anyway

Sorry then. Iā€™ll take a look at getting Discord (and BetterDiscord) working in F25 later on.

I managed to figure out how to install Discord in F25, and also was able to get the BetterDiscord installer up and running;


Not really sure if it matters, I went with the MATE-Compiz spin, since it's the closest to Ubuntu MATE I can get with Fedora in my desired configuration.

Some things are different because of how I went about this. None of the paths really matter; use your own for betterDiscord itself, but BetterDiscord's requirement of /var/local/BetterDiscord remains hard and fast. Here's the rundown of what I did on F25;

  • I used Sim0nizer's Discord installer (ran via commandline)
  • I used its default path of /opt/Discord (this can differ based on your configuration)
  • I installed BetterDiscord itself to /opt/Discord/BetterDiscord (this too can differ)
  • I still had to go to that directory's lib subdirectoty to rename Utils.js so it is lowercase
  • /var/local/BetterDiscord/bdstorage.json didn't need to be renamed. (This must had been fixed after-the-fact.) I lied. Sorry.

I was able to install npm and git, Do all the Git stuff, do all the NPM stuff, and make the installer usable.

One more quick edit to drive the point home it works on F25;

Iā€™ve sort of got it working but itā€™s not 100%
only the ā€˜custom CSSā€™ option works correctly, and there seems to be no betterdiscord folder at all but itā€™s a step in the right direction at least ^^
thanks for your help, Iā€™ll keep working on it for now :wink:

edit
after far too long, itā€™s working
thanks for all the help ^^

I heard people around the net and maybe here were having this common problem. A friend and I fixed it together and I thought I would share!

System Specs:
OS: Ubuntu 17.04 zesty
Kernel: x86_64 Linux 4.10.0-22-generic
DE: MATE 1.18.0

After following all the steps and installing better discord (and trying to uninstall it and install regular discord again) I got this error:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module '/usr/local/share/BetterDiscord/BetterDiscordApp-stable16'
at Module._resolveFilename (module.js:455:15)
at Function.Module._resolveFilename (/usr/share/discord/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. (/usr/share/discord/resources/app/index.js:2:22)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)

What we did to get regular discord working again:

  1. sudo apt-get purge --auto-remove discord
  2. sudo apt-get clean
  3. then I navigated to /usr/share/

cd /
cd usr/share/
ls
on the list you should see the discord file-folder in there

4.sudo rm -rf discord
(if using canary, do sudo rm -rf discord-canary)

This is where the files that keep directing discord to the error are living, I believe.

5.I reinstalled discord using the instructions here

Hope this helps anyone who has been trying to revert back but cant!

2 Likes

This should be linked from the github, the only way I was able to install it on Void Linux, there was no other info anywhere.

A few things:

I didnā€™t want to run electron as root, so to install it I chown -Rā€™d /usr/share/discord as my username and the group the same

cd /usr/share
sudo chown -R pizzadude:pizzadude discord/ (in my case)

Not the best solution, cuz now every app can write to the discord folder, but it works.

Also, to fix the javascript error I had to:

cd ~/.BetterDiscord
ln -s bdstorage.json bdStorage.json

If youā€™re a newbie and youā€™re reading this BE CAREFUL with chown.

I donā€™t need to chown anything if I am linking into a directory I own. Thatā€™s part of the reason why I took to that method rather than chown'ing the directories the Electron installer made, and documentation from the BetterDiscord guild stated to run Electron as root, so I went with that.

The tutorial didnā€™t mention moving /usr/share/discord to somewhere else, and then replacing it with a symbolic link. /usr/share/discord is where the discord files are installed after you install the Discord deb, and the files are owned by root. Thatā€™s why the Electron installer ā€œrequiredā€ root. But it doesnā€™t require root if I chowned /usr/share/discord as my own username. Also, whether the BetterDiscord guild suggests it or not, I donā€™t feel comfortable running Electron, which is essentially Chromium, as root.