1.1.5 • Published 2 years ago

betterdiscord-plugin-updater v1.1.5

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
2 years ago

BetterDiscord Plugin Updater

Library to assist in updating BetterDiscord plugins automatically

NPM

Install

npm install betterdiscord-plugin-updater

Usage

This plugin should be compatible with both ESM and CJS.

To check for updates, use isUpdateAvailable. This will return a promise resolving to a boolean (true|false) to determine if an update is available.

To allow the user to download the most up-to-date version of your plugin, use showUpdateBanner. This will display a banner on the top of discord allowing the user to accept or refuse the available update.

To forcefully download an the most up-to-date version of your code, either without user interaction or for custom implementation, use installUpdate.

NOTE: To abide by the BetterDiscord Plugin policy, you should not trigger an update yourself, it must be triggered by the user.

Example

// ESM
import { Updater } from 'betterdiscord-plugin-updater'
// CJS
const { Updater } = require('betterdiscord-plugin-updater');

// Initialize the updater in `load` to ensure it is available when the plugin starts
load() {
  this.updater = new Updater(updateURL, currentVersion);
}

// Please use in `start` to ensure the updater only runs when the plugin is enabled
start() {
  // Run the updater routine as soon as possible
  this.doUpdate();
}

async doUpdate() {
  const isUpdateAvailable = await this.updater.isUpdateAvailable();

  if (isUpdateAvailable) {
    await this.updater.showUpdateBanner();
  }
}

License

WTFPL

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.0

2 years ago