v2.0.0
Breaking changes:
- Don't connect on initialisation by default. (#116)
- Switch from
bluebird
tobluebirdish
. (#115) - Switch from
got
tonode-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, useHistoryEntry#timestamp
instead. (#115) - Remove
HistoryEntry#dj
, useHistoryEntry#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. UseHistoryEntry#user
instead.HistoryEntry#time
- this was renamed toHistoryEntry#timestamp
for consistency with other classes.mp.on('waitlistBan')
- the 'waitlistBan' event was renamed to 'modWaitlistBan'.