Skip to content

Instantly share code, notes, and snippets.

@mininmobile
Last active April 6, 2026 18:33
Show Gist options
  • Select an option

  • Save mininmobile/aff422d0784e78a13e167b8627633629 to your computer and use it in GitHub Desktop.

Select an option

Save mininmobile/aff422d0784e78a13e167b8627633629 to your computer and use it in GitHub Desktop.

Revisions

  1. mininmobile revised this gist Nov 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion example.plugin.js
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ class Example {
    }

    // Load/Unload
    load() { }
    load() { }

    unload() { }

  2. mininmobile revised this gist Nov 12, 2017. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions example.plugin.js
    Original file line number Diff line number Diff line change
    @@ -23,10 +23,6 @@ class Example {

    unload() { }

    if (typeof window.ZeresLibrary !== "undefined") this.initialize();
    else libraryScript.addEventListener("load", () => { this.initialize(); });
    }

    // Events

    onMessage() {
    @@ -44,13 +40,17 @@ class Example {
    // 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 (!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.");
  3. mininmobile created this gist Nov 12, 2017.
    64 changes: 64 additions & 0 deletions example.plugin.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    //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() { }

    if (typeof window.ZeresLibrary !== "undefined") this.initialize();
    else libraryScript.addEventListener("load", () => { this.initialize(); });
    }

    // 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);
    }

    stop() {
    PluginUtilities.showToast(this.getName() + " " + this.getVersion() + " has stopped.");
    };

    // Initialize
    initialize() {
    this.initialized = true;
    PluginUtilities.showToast(this.getName() + " " + this.getVersion() + " has started.");
    }
    }