DiscordInjections
August 11, 2017 ยท View on GitHub
This script aims to pick up where BeautifulDiscord ends. Not only does it support custom CSS injections, but it also gives you the ability for custom JavaScript.
DTinker
Need help installing? Want to give a suggestion? Want to just chat? I'm using DTinker as a hub for DiscordInjections! Click right on Lil' Bub's face to go there!
(Or click here if you're boring)
Features
- Custom CSS
- CSS hot-loading and watching
- Custom JS in the form of Plugins
- Custom commands
- Custom settings
- Exposes the native Discord WebSocket and localStorage
- Transparency and frame settings
Requirements
This module requires you to have node.js installed with ES6 support.
This module optionally requires git for easier version updating.
Installation
-
Go to the directory you would like to install this module in
-
Download the files
With releases
- Download the latest release
- Extract to the desired location
With git
- Type
git clone https://github.com/DiscordInjections/DiscordInjections folderName - (optional) Type
git checkout tags/<VERSION>to go to a specific version. This is recommended
-
Type
cd folderName -
Run
npm install -
Run
npm run inject -
Edit the config.json file as desired
-
Install any desired plugins, and then run
npm run install-plugins
To uninstall, run npm run uninject
To reinstall, run npm run reinject
Updating
WARNING: If you currently have version 1.X.X or 2.X.X installed, you must run npm run uninject before doing this step, and then npm run inject afterwards!
With releases
- Download the latest release
- Extract to the desired location
With git
- Run
git fetch --tags - Run
git checkout tags/<VERSION>
Next Steps
- Make sure all dependencies are installed (run
npm install- new dependencies might have been added)
Usage
All usage takes place in the folder you installed DiscordInjections into.
Config
DiscordInjections has some configuration options. A default config.json file is generated when you run npm run inject (this will not overwrite existing files).
{
// This makes the background of the client transparent. On linux, you must run discord with the `--enable-transparent-visuals` flag!
"transparent": false,
// Set to `true` or `false` to enable or disable the OS frame around the client. Leave as `null` to use default client settings.
"frame": null
}
CSS
By default, DiscordInjections looks for a style.css file within the CSS folder. This file is not provided.
For a custom location, open the General Settings DiscordInjections settings tab in the user settings.
JavaScript
There are two segments of JS that get injected.
Preload/index.js
This is content that gets injected before anything else in the discord client. It is what enables us to intercept the WS and localStorage objects. Put things that need to be loaded first here. Generally, this should not be modified.
Plugins
For extensibility, DiscordInjections uses a simple plugin system. Plugins are placed in the Plugins/ directory.
To create a plugin, you must extend the Structures/Plugin class. See the Plugins/SamplePlugin.js.EXAMPLE file for an example.
For a list of plugins, visit Plugins
WARNING
Plugins can be dangerous. Please read the disclaimer.
Note
Do not touch the DomReady directory, as it is what handles the custom CSS injections and plugins.
WebSockets and localStorage
Discord deletes its websocket and localStorage references to prevent tampering. In order to prevent deletion, these variables are stored to DI.ws and DI.localStorage respectively.
Additionally, Discord initiates a new websocket object every reconnect. To ensure that your implementation works properly, you should define a window.onWebsocketReload function, that takes a websocket as an input.
Disclaimer
DiscordInjections is not responsible for any plugins created by a third party. Needless to say, running plugins can be extremely dangerous as it exposes your entire discord client, as well as localStorage.
Before adding a plugin, be sure to thoroughly check its code to see what it does.
Stay safe.
