Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

v2.0.0

Compare
Choose a tag to compare
@goto-bus-stop goto-bus-stop released this 30 Jun 19:44
e2bb386

Breaking changes:

  • Don't connect on initialisation by default. (#116)
  • Switch from bluebird to bluebirdish. (#115)
  • Switch from got to node-fetch. (#115)

See below for upgrade instructions.

Features:

  • Return Room instance from .join(). (#115)

Removed:

  • Remove 'waitlistBan' event alias, use 'modWaitlistBan' instead. (#115)
  • Remove HistoryEntry#time property alias, use HistoryEntry#timestamp instead. (#115)
  • Remove HistoryEntry#dj, use HistoryEntry#user instead. (#115)

Don't connect on initialisation

This change affects everyone.

v1.x accepted email and password options in the miniplug() constructor, and immediately connected to the plug.dj API and socket. This was handy but there was no clear way to handle login or connection failures. Now, this functionality has been split up, and the .connect() method must be used. .connect() returns a Promise, which you can attach .catch() handlers to. See its documentation for more.

const mp = miniplug()
mp.connect({ email: 'test@miniplug.com', password: 'hunter2' }).catch((err) => {
  console.error('connection failed:', err.message)
  process.exit(1)
})

// Then just use it as normal.
mp.join('radiant')

Switch to node-fetch

This change only affects you if you use the response property on Errors thrown by miniplug.

node-fetch is significantly smaller than got, and implements the web standard Fetch API.

Previously, error.response would contain a Got response object, now it contains the Response object from the Fetch API.

Switch to bluebirdish

This change only affects you if you use Bluebird timeouts, cancellation, or disposers.

bluebirdish provides a similar API to Bluebird, but is built on native Promises. It is compatible in all features it implements, but it doesn't support a few things. In most situations, you should not have to change any code. If you were using .timeout(), .cancel(), or resource management with Promise.using() and .disposer(), that will no longer work by default. You can use Bluebird.resolve(p) to convert a bluebirdish Promise p from the miniplug API to a Bluebird Promise.

Removed deprecated names

These properties and events were removed and will now throw an error:

  • HistoryEntry#dj - this was never supposed to exist, and did not exist consistently. Use HistoryEntry#user instead.
  • HistoryEntry#time - this was renamed to HistoryEntry#timestamp for consistency with other classes.
  • mp.on('waitlistBan') - the 'waitlistBan' event was renamed to 'modWaitlistBan'.