Prerequisites
Before you start developing plugins, make sure you have:- BetterDiscord installed
- A text editor (VS Code, Sublime Text, etc.)
- Basic knowledge of JavaScript
- Familiarity with Discord’s interface
Your first plugin
Create the plugin file
Navigate to your BetterDiscord plugins folder and create a new file named
MyFirstPlugin.plugin.js.The plugins folder location varies by platform:- Windows:
%appdata%/BetterDiscord/plugins - macOS:
~/Library/Application Support/BetterDiscord/plugins - Linux:
~/.config/BetterDiscord/plugins
Add the plugin structure
Create a basic plugin structure with the required metadata and lifecycle methods:
MyFirstPlugin.plugin.js
Enable the plugin
Open Discord and navigate to User Settings > Plugins. You should see your plugin listed. Toggle it on to activate it.
Using BdApi
BetterDiscord provides a globalBdApi object that gives you access to various utilities. Here’s an example that shows a toast notification:
Accessing plugin information
You can create a plugin-specific BdApi instance by passing your plugin name to the constructor:Adding interactivity
Here’s a simple plugin that adds a button to show an alert:Next steps
Plugin structure
Learn about plugin metadata, exports, and file organization
BdApi overview
Explore the complete BdApi and its namespaces
Settings
Add configurable settings to your plugin
Best practices
Follow best practices for reliable plugins