Last active
July 10, 2024 23:19
-
-
Save mininmobile/aff422d0784e78a13e167b8627633629 to your computer and use it in GitHub Desktop.
Example BetterDiscord Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//META{"name":"Example"}*// | |
class Example { | |
// Constructor | |
constructor() { | |
this.initialized = false; | |
} | |
// Meta | |
getName() { return "Example"; } | |
getShortName() { return "Example"; } | |
getDescription() { return "This is an example/template for a BD plugin."; } | |
getVersion() { return "0.1.0"; } | |
getAuthor() { return "Minin"; } | |
// Settings Panel | |
getSettingsPanel() { | |
return "<!--Enter Settings Panel Options, just standard HTML-->"; | |
} | |
// Load/Unload | |
load() { } | |
unload() { } | |
// Events | |
onMessage() { | |
// Called when a message is received | |
}; | |
onSwitch() { | |
// Called when a server or channel is switched | |
}; | |
observer(e) { | |
// raw MutationObserver event for each mutation | |
}; | |
// Start/Stop | |
start() { | |
var libraryScript = document.getElementById('zeresLibraryScript'); | |
if (!libraryScript) { | |
libraryScript = document.createElement("script"); | |
libraryScript.setAttribute("type", "text/javascript"); | |
libraryScript.setAttribute("src", "https://rauenzi.github.io/BetterDiscordAddons/Plugins/PluginLibrary.js"); | |
libraryScript.setAttribute("id", "zeresLibraryScript"); | |
document.head.appendChild(libraryScript); | |
} | |
if (typeof window.ZeresLibrary !== "undefined") this.initialize(); | |
else libraryScript.addEventListener("load", () => { this.initialize(); }); | |
} | |
stop() { | |
PluginUtilities.showToast(this.getName() + " " + this.getVersion() + " has stopped."); | |
}; | |
// Initialize | |
initialize() { | |
this.initialized = true; | |
PluginUtilities.showToast(this.getName() + " " + this.getVersion() + " has started."); | |
} | |
} |
probably old thread, but is there any documentations for creating BetterDiscord scripts/plugins? like d.js or d.py
Instead of BetterDiscord I'd recommend Vencord, they don't have an actual guide but you can easily learn how the plugins are made by reading their code and asking in the discord server for help.
Don't expect help from me tho, as I was perma muted for being annoying to the owner.
(To be fair I was actually annoying most of the time)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
probably old thread, but is there any documentations for creating BetterDiscord scripts/plugins? like d.js or d.py