Methods
-
<static> checkForUpdate( pluginName, currentVersion, updateURL [, versioner [, comparator ] ] )
-
Description
Checks for updates for the specified plugin at the specified link. The final parameter should link to the raw text of the plugin and will compare semantic versions.
Parameters
Name Type Attributes Description pluginName
string name of the plugin
currentVersion
string current version (semantic versioning only)
updateURL
string url to check for update
versioner
module:PluginUpdater~versioner <optional> versioner that finds the remote version. If not provided uses module:PluginUpdater.defaultVersioner.
comparator
module:PluginUpdater~comparator <optional> comparator that determines if there is an update. If not provided uses module:PluginUpdater.defaultComparator.
Details
-
<async, static> processUpdateCheck( pluginName, updateLink )
-
Description
Will check for updates and automatically show or remove the update notice bar based on the internal result. Better not to call this directly and to instead use module:PluginUpdater.checkForUpdate.
Parameters
Name Type Description pluginName
string name of the plugin to check
updateLink
string link to the raw text version of the plugin
Details
-
<static> defaultVersioner( currentVersion, content )
-
Description
The default versioner used as module:PluginUpdater~versioner for module:PluginUpdater.checkForUpdate. This works on basic semantic versioning e.g. "1.0.0". You do not need to provide this as a versioner if your plugin adheres to this style as this will be used as default.
Parameters
Name Type Description currentVersion
string content
string Details
-
<static> defaultComparator( currentVersion, content )
-
Description
The default comparator used as module:PluginUpdater~comparator for module:PluginUpdater.checkForUpdate. This works on basic semantic versioning e.g. "1.0.0". You do not need to provide this as a comparator if your plugin adheres to this style as this will be used as default.
Parameters
Name Type Description currentVersion
string content
string Details
-
<static> createUpdateButton() → {HTMLElement}
-
Description
Creates the update button found in the plugins page of BetterDiscord settings. Returned button will already have listeners to create the tooltip.
Returns
Details
-
<static> downloadPlugin( pluginName, updateLink )
-
Description
Will download the latest version and replace the the old plugin version. Will also update the button in the update bar depending on if the user is using RestartNoMore plugin by square https://github.com/Inve1951/BetterDiscordStuff/blob/master/plugins/restartNoMore.plugin.js
Parameters
Name Type Description pluginName
string name of the plugin to download
updateLink
string link to the raw text version of the plugin
Details
-
<static> showUpdateNotice( pluginName, updateLink )
-
Description
Will show the update notice top bar seen in Discord. Better not to call this directly and to instead use module:PluginUpdater.checkForUpdate.
Parameters
Name Type Description pluginName
string name of the plugin
updateLink
string link to the raw text version of the plugin
Details
-
<static> removeUpdateNotice( pluginName )
-
Description
Will remove the plugin from the update notice top bar seen in Discord. Better not to call this directly and to instead use module:PluginUpdater.checkForUpdate.
Parameters
Name Type Description pluginName
string name of the plugin
Details
Type Definitions
-
versioner( fileContent ) → {string}
-
Description
Function that gets the remote version from the file contents.
Parameters
Name Type Description fileContent
string the content of the remote file
Returns
Details
-
comparator( currentVersion, remoteVersion ) → {boolean}
-
Description
Comparator that takes the current version and the remote version, then compares them returning
true
if there is an update andfalse
otherwise.Parameters
Name Type Description currentVersion
string the current version of the plugin
remoteVersion
string the remote version of the plugin
Returns
Details