Skip to content

Releases: yamdbf/core

v3.0.0

10 Aug 23:08
Compare
Choose a tag to compare

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)

v2.6.2

11 Feb 09:28
Compare
Choose a tag to compare

Just a couple quick changes and the first test of automatic docs building

Changes

  • Removed automatic guild storage sweeping and exposed a method (Bot#sweepStorages) to do so manually (3c6e3e8)

Fixes

  • Fix limit/clearlimit error on empty args (5e8b6ba)

v2.6.1

10 Feb 02:28
Compare
Choose a tag to compare

Following in the footsteps of Discord.js, I've moved development to master and will be pushing stable repo states to the stable branch when preparing new releases. Git flow was nice but I suppose I wasn't doing it right in the end.

Additions

  • Import Discord and Yamdbf in eval command for easy access (8882b63)
  • Truncate default help command list if too long (4a699c6)
  • Add BotOptions#noCommandErr (9cc39be)
  • Add GuildStorage#incr/deincr/incrSetting/deincrSetting methods (6994fbd)
  • Add LocalStorage#incr/deincr methods (6994fbd)
  • Add CommandInfo#hidden (ce1980e)

Fixes

  • Fix method name typo for CommandDispatcher#failedLimiterError (9ec8795)
  • Fix TypeError in limit/clearlimit commands (f62c2e9)
  • Fix empty string and NaN args (80bdd02)
  • Fix calling eval command via mention (c780690)

v2.6.0

13 Jan 03:18
Compare
Choose a tag to compare

Updates

  • Add limit and clearlimit commands for limiting given commands to certain roles
    • This will likely replace the roles CommandOptions field completely as the functionality
      is much more open to customization on a per-guild basis rather than requiring guilds to
      create role names that match the given role for a command. Though this does add a level
      of setup required to bots as all commands that don't require specific permissions are
      open to all users until a server admin limits command usage to certain roles.
    • Commands are not limited to any roles by default since roles are unique to guilds
    • limit command requres args to be separated by commas, since each role name is an arg
      and role names can have spaces in them. for example <prefix>limit ping, mod will limit
      the ping command to a role that can be found by name with the full text mod via fuzzy
      comparison. Multiple role names can be passed, again separated by commas. The command
      is additive, so calling the command again with more roles will add those roles to the limiter
      for the command rather than overwriting any previously set roles
    • clearlimit does what the name suggests. It will clear all roles from the limiter for the command
  • Allow selfbots to bypass permission/role checks
  • Pass execution time and message object with command event
  • Attach associated GuildStorage to message.guild Guild object
  • Update Eval command to wait for Promises to resolve
  • Update Help command output
  • Other minor command tweaks

Deprecation

  • LocalStorage/GuildStorage#nonConcurrentAccess has been deprecated and will be removed in a future release.
    • Switch to LocalStorage/GuildStorage#queue instead. The functionality is identical but the name is more terse and it's been improved with regards to handling async callbacks
  • Command#roles may be removed in the future in favor of the new limit command functionality. Still undecided on this

Bug fixes

  • Fix for non-space command arg separators