- Bandaged Better Discord
- plugins go here
%appdata%/BetterDiscord/plugins
- Its javascript so I pull libraries > plugins
runelite.plugin.js
> plugins
Last active
January 30, 2019 00:30
-
-
Save abextm/9f00c7aa4270c506969eb9b9ac00629b to your computer and use it in GitHub Desktop.
runelite bbd 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":"RuneLite"}*// | |
class RuneLite { | |
getName() { return "RuneLite"; } | |
getVersion() { return "1.0.0"; } | |
getAuthor() { return "Abex"; } | |
getDescription() { return "WOOOOOOOOOOOOOOOOOOOOOOOOOOO"; } | |
addButtons(btnContainer) { | |
var extraBtnClasses = btnContainer.querySelector(":scope>div").className; | |
var btn = (lbl, command) => { | |
var el = document.createElement("button") | |
el.className = "runelite rl-button " + extraBtnClasses; | |
el.textContent = lbl; | |
el.addEventListener("click", ev => { | |
ZLibrary.DiscordAPI.currentChannel.sendMessage(command); | |
}); | |
return el; | |
}; | |
var rejected = btn("R", "!rejected"); | |
btnContainer.insertBefore(rejected, btnContainer.firstChild); | |
btnContainer.insertBefore(btn("L", "!linkerror"), rejected); | |
} | |
start() { | |
if (!global.ZeresPluginLibrary) return window.BdApi.alert("Library Missing", `The library plugin needed for ${this.getName()} is missing.<br /><br /> <a href="https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js" target="_blank">Click here to download the library!</a>`); | |
BdApi.injectCSS("rl-css", ` | |
/* Hide gif and nitro buttons*/ | |
.da-buttons>*:not(.da-emojiButton):not(.rl-button) { | |
display:none; | |
} | |
/* rl macros */ | |
.rl-button { | |
margin: .5em .2em; | |
padding: 0 .5em; | |
color: #999 | |
} | |
.rl-button:hover { | |
color: #222; | |
} | |
/* hide the stupid dropdown because it makes everyone not right click */ | |
.da-message .da-buttonContainer { | |
display:none; | |
} | |
`); | |
var btnContainer = document.querySelector(".da-buttons"); | |
if (btnContainer) { | |
this.addButtons(btnContainer); | |
} | |
} | |
stop() { | |
BdApi.clearCSS("rl-css"); | |
[...document.querySelectorAll(".runelite")].forEach(el => el.parentElement.removeChild(el)); | |
} | |
observer(e) { | |
if (!e.addedNodes.length || !(e.addedNodes[0] instanceof Element)) return; | |
var btnContainer = e.addedNodes[0].querySelector(".da-buttons"); | |
if (btnContainer) { | |
this.addButtons(btnContainer); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment