Skip to content

v3.0.0

Latest
Compare
Choose a tag to compare
@zajrik zajrik released this 10 Aug 23:08
· 245 commits to master since this release

The long awaited 3.0.0 release! This release features a complete port to Typescript and heavy rewrites of the majority of the framework. A lot of things have been broken since previous releases and your code will need to be updated accordingly. The docs have also been overhauled, hopefully in a manner that makes this transition easier for everyone overall.

Post-install building has been added so indev builds can be installed straight from github via npm install --save zajrik/yamdbf

Breaking Changes

  • Require Node 8+ to use (c0c9648)
  • Rename Bot class to Client (77200d0)
    • Rename BotOptions to YAMDBFOptions
      • This is mainly a docs change, but does affect Typescript if importing the types
      • Renamed YAMDBFOptions#noCommandErr to unknownCommandError (03eb421)
  • Changed startup process for new storage compatibility (See guide)
  • Completely rewrote storage mechanics for the framework
    • All client/guild storage/settings methods are now asynchronous, supporting await/.then() as needed when retrieving values or waiting for a storage operation to finish before proceeding
    • Custom storage providers can be written to have your bot use whatever database or storage solution you want for client storage and guild storage/settings for full control over storage backend management on your part
    • Added abstract StorageProvider for creating custom storage providers (5eac4af)
    • Added Providers.JSONProvider as default storage provider (5eac4af)
    • Added Providers.PostgresProvider storage provider (d68aaba)
    • Added Providers.SQLiteProvider storage provider (0ad5bbe)
    • The overall structure for accessing storages has changed
      • Guild storage access has changed from <Bot>.guildStorages.get(guild.id) to <Client>.storage.guilds.get(guild.id). GuildStorage is still accessible via message.guild.storage in commands called within a guild text channel
      • Storage methods on both client storage and guild storage like getItem() and setItem() have been changed to get() and set(). Refer to the docs for more information
      • Guild settings methods like getSetting(), setSetting() etc have been moved to .settings.get(), .settings.set() etc. on the base GuildStorage object retrieved when getting a guild's storage from <Client>.storage.guilds.get(...). The docs will be very helpful during this transition, as they detail everything clearly
  • CommandRegistry#filterGuildUsable() is now asynchronous (aba273f)
  • Storage related Client methods are now asynchronous (63292eb)
    • Client#setDefaultSetting()
    • Client#removeDefaultSetting()
    • Client#defaultSettingExists()
    • Client#getPrefix()
  • Removed ArgOpts.stringArgs (7bffdd5)
    • Args are now always strings by default. If numbers are desired, middleware can be used, or they can be parsed within your command logic
  • Renamed Command#_respond to Command#respond and exposed as protected method (5470a51, ea6975e)
  • Renamed CommandInfo/Command#permissions to CommandInfo/Command#callerPermissions (1f3c3fe)
  • Renamed CommandInfo/Command#description and extraHelp to desc and info respectively (721d8ad)
  • Removed Client#config and the config client options field (1945eaa)
    • This adds an owner field to the ClientOptions object that accepts a string ID or array of string IDs for users that can use ownerOnly commands
  • Removed Client#name, Client#version, and the version command (8dbe49e)
  • Removed the client (originally bot) param from the Command constructor (78820fa)
    • Classes extending Command must now only pass the CommandInfo object to super()
  • Removed CommandRegistry#filterDMHelp(), filterDMUsable(), and filterGuildUsable() (9871e2c)

Changes

  • Rewrote CommandDispatcher (less execution overhead!) (3d7fc46, dc134fb, bd7e697)
  • Reworked command loading to allow any manner of command exports (98f3d2b)
  • Changed prefix removal keyword in setprefix command to clear (b046d10)
  • Made command calling case-insensitive (910e3fd)

Additions

  • Added command middleware functionality (9beb59b)
    • Added middleware function for resolving arg types (a0a63bd, cd2a2e3)
    • Added middleware function for asserting arg types (affd013)
    • Added global middleware to run on ALL commands (b1ecc4d)
  • Added Client#isOwner() (a7518df)
  • Added user blacklisting, associated command + events (12042f3, c697929, bc59e68)
  • Added configurable global/command-specific ratelimiting (472f247)
  • Added a Logger class to handle all logging within the framework (d6304b8)
    • Can be used within your bots as well. Refer to the docs for more information
    • Supports custom transports for alternative logging methods (Like logging to file)
    • Adds logLevel to the options to be passed to the client. This defaults to LogLevel.DEBUG but can be set lower or to LogLevel.NONE if desired to turn off logging. You will need to import LogLevel from yamdbf for this
  • Add support for relative paths in YAMDBFInfo#commandsDir (ba5812c)
  • Add Util.baseCommandNames to simplify disabling all base commands (ba89cec)
  • Add CommandInfo/Command#clientPermissions (977e463)
  • Add Command#disable(), enable(), disabled (9871e2c)
  • Add Command#init() for command initialization step (62d94f9)
  • Add localization support (e0514dc, 52bb9ad, 05a51d4, 740c028, 0bcaf84 and many others)
    • Comes with localize middleware and localizable decorator to simplify localizing commands
    • Custom .lang file type designed specifically for providing localizations for YAMDBF Clients
      • Supports templating and embedded scripting for dynamic string content
      • This allows customizing default output somewhat without having to overload base commands
  • Add Plugin support (eb25cb2)
    • Allows an easy way to provide custom commands/languages/functionality
      for any YAMDBF Client
  • Add Util.wasCommandCalled() (ca2877b)

Typescript-specific additions

  • Added Command metadata decorators (32c0949)
  • Added using method decorator for assigning middleware to command actions (ca0becd)
  • Added IStorageProvider interface to help in creating custom storage providers (1f1941b)
  • Added logger property decorator for easier Logger assignment (d6304b8)
  • Added deprecated method decorator (More for internal use, but you could use it, too) (ef7cf41)
  • Add ListenerUtil, containing decorators for creating event listeners (c951fee, 422b6ad)
  • Add typescript-specific eval command that compiles and evaluates TS code (fd198d7)

Fixes

  • Fix external docs links (9cf0f95)
  • Fix command prefix removal (b046d10)