Fix headings
parent
014be217cb
commit
902ec5045e
|
@ -1,6 +1,6 @@
|
|||
IMPORTANT: Name your plugins `*.plugin.js` this will be enforced in the plugin loader soon.
|
||||
|
||||
##Building a plugin
|
||||
## Building a plugin
|
||||
Take a look at the [Example Plugin](https://gist.github.com/Jiiks/71edd5af0beafcd08956) for a template
|
||||
|
||||
Checkout some of the plugins from the official [BetterDiscord Repository](https://github.com/Jiiks/BetterDiscordApp/blob/master/Plugins).
|
||||
|
@ -29,13 +29,13 @@ BdApi.getUserNameById("id");
|
|||
Core.prototype.alert("title", "text")
|
||||
```
|
||||
|
||||
##Details
|
||||
## Details
|
||||
|
||||
####Plugins are limited to one file.
|
||||
#### Plugins are limited to one file.
|
||||
There can be multiple files in the BetterDiscord plugins directory, but to prevent junk and prevent future collisions,
|
||||
it is best practice to include your entire plugin within one .js file.
|
||||
|
||||
####Plugins have a special identifier
|
||||
#### Plugins have a special identifier
|
||||
BetterDiscord requires two lines at the beginning of a plugin file to identify it:
|
||||
```
|
||||
//META{"name":"testPlugin"}*//
|
||||
|
@ -45,17 +45,17 @@ function testPlugin() {}
|
|||
Without these, your plugin will not be identified by BD properly and will not show up in the list.
|
||||
|
||||
|
||||
####Discord isn't just a browser
|
||||
#### Discord isn't just a browser
|
||||
Discord is node.js and chromium as one. BetterDiscord plugins can use all native node.js functions and modules.
|
||||
It is possible to include pure js node modules within your plugin using webpack. Any modules that require
|
||||
compilation and/or do not have pure js alternatives will of course not work.
|
||||
|
||||
####Plugins are susceptible to throttling.
|
||||
#### Plugins are susceptible to throttling.
|
||||
By default, Discord will throttle plugins when Discord is minimized.
|
||||
Currently there are no in-plugin workarounds to fix this.
|
||||
Throttling is the same as chromium, functions like setInterval and setTimeout will be throttled to at least 1000ms
|
||||
|
||||
####Add namespaces to your events.
|
||||
#### Add namespaces to your events.
|
||||
When creating selectors like $(document).on('dblclick'), instead use a namespace such as
|
||||
$(document).on('dblclick.dce') in order to easily unload the event with $(document).off("dblclick.dce")
|
||||
without unloading all dblclick events.
|
||||
|
|
Loading…
Reference in New Issue