Skip to content

Instantly share code, notes, and snippets.

@mininmobile
Last active July 16, 2023 13:57
Show Gist options
  • Save mininmobile/aff422d0784e78a13e167b8627633629 to your computer and use it in GitHub Desktop.
Save mininmobile/aff422d0784e78a13e167b8627633629 to your computer and use it in GitHub Desktop.
Example BetterDiscord Plugin
//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.");
}
}
@ilovedogs1235
Copy link

how do you get the context of the sent message

@mininmobile
Copy link
Author

idk lol

@numselli
Copy link

how do you get the context of the sent message

probably
onMessage(message) { // Called when a message is received };

@HyperCodec
Copy link

is it possible to make one using python?

@mininmobile
Copy link
Author

nope

@WarnerDev
Copy link

its possible to run a python file or something using BetterDiscord plugin?

@Pixelwarp
Copy link

its possible to run a python file or something using BetterDiscord plugin?

No only JavaScript

@loadfunctype
Copy link

useful

@estiloloco
Copy link

Thanks!!

@xenontf
Copy link

xenontf commented Mar 6, 2021

how do i make it send a message lol

@HyperCodec
Copy link

Lol idk I use d.py not d.js

@Giorgouis
Copy link

Lol idk I use d.py not d.js

betterdiscord plugins use js

@ArjixWasTaken
Copy link

ArjixWasTaken commented Apr 3, 2021

it is possible to use python, just make a REST api in python and make the addon contact it

Pro tip: this is a stupid thing to do

@chakany
Copy link

chakany commented Apr 17, 2021

yeah just install express then 🚀

@PiciAkk
Copy link

PiciAkk commented Apr 17, 2021

how can you change your username?

@chakany
Copy link

chakany commented Apr 18, 2021

how can you change your username?

google "how to change your github username" 🙏

@ArjixWasTaken
Copy link

how can you change your username?

google "how to change your github username" 🙏

you lost ur chance to say "Google is ur best friend"
and now you have to live on with it

@Maurice037
Copy link

can I fetch data from my api ?

@H3XDaemon
Copy link

How to fix plugin could not be stopped

@LuckyDevStuff
Copy link

is there any way to get the token or some way to the api to send msgs and change ur status...?

@NotCookey
Copy link

is it possible to make one using python?

just why would you want to make it in python? When you can code it in javascript. Not everything should be exported to a different language

@NotCookey
Copy link

is there any way to get the token or some way to the api to send msgs and change ur status...?

just use the discord official api for those stuffs, inspect the get/post/patc requests and use thh requests and use the url's and the headers to manipulate the account

@dracsta
Copy link

dracsta commented Jun 28, 2022

How to fix plugin could not be stopped

Check out error content in console. It's probably because PluginUtilities is not defined, you don't need to add toast which says that your plugin has been disabled, because BetterDiscord does that automatically. (just delete all PluginUtilities.showToast functions)

@RuriYoshinova
Copy link

RuriYoshinova commented Jul 16, 2023

probably old thread, but is there any documentations for creating BetterDiscord scripts/plugins? like d.js or d.py

@ArjixWasTaken
Copy link

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