Skip to content

v1.4.0

Latest

Choose a tag to compare

@Abadima Abadima released this 22 Nov 02:44

⚠️ Behavior Changes

  • Failed database writes now reject instead of only being logged, and connect() rejects if it fails.
  • XP no longer goes below 0, and fractional levels are rounded down.
  • levelUp now also fires for new users who start above level 0.
  • lvlRole() now throws when the user ID or server ID is missing.

✅ Additions

  • Add typings for roleSetup, options, addXP({ min, max }), lvlbar, lvlbarBg and the pie chart.
  • Accept any Message or Client-shaped object in the typings, fixing TypeScript errors in ESM projects.

⚒️ Bug Fixes

  • Fix a user only being able to have XP in one server. connect() replaces the old index, so it needs permission to manage indexes.
  • Fix addXP(), addLevel() and setXP() for users with no record, and simultaneous calls losing XP.
  • Fix levelUp firing incorrectly, and 0 or negative values being mishandled.
  • Fix charts() throwing when called without options.
  • Fix leaderboard() with auto_purge deleting members whose lookup only failed.
  • Fix a billion showing as 1T in fetch() and leaderboard().
  • Fix smaller issues in reset(), create() and roleSetup.remove().

⬆️ Dependencies

  • Replace mongoose with the official mongodb driver (^6.22.0). Install mongoose yourself if you used it through simply-xp.
  • Remove chart.js; charts() now draws its own charts.
  • Bump @napi-rs/canvas from v0.1.88 to v1.1.1.
  • Limit the discord.js peer dependency to ^13.12.0 || ^14.19.0.
  • Require Node.js 16.20.1 and MongoDB 4.2 or newer (Bun 1.1.39 also works).

⭐ Improvements

  • Install size drops from 28 packages / 70 MB to 15 packages / 44 MB.
  • Load about 40% faster, with 40–70% faster database calls and about 35% less peak memory. connect() takes about 10 ms longer, once.
  • setXP() now returns { xp, level }.
  • Rewrite the internals, add npm test and replace eslint with oxlint and oxfmt.

💎 Design Changes

  • Redraw charts() with readable text on any background, the bundled font and rotating labels.

Full Changelog: v1.3.8...v1.4.0