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 toClient
(77200d0)- Rename
BotOptions
toYAMDBFOptions
- This is mainly a docs change, but does affect Typescript if importing the types
- Renamed
YAMDBFOptions#noCommandErr
tounknownCommandError
(03eb421)
- Rename
- 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 viamessage.guild.storage
in commands called within a guild text channel - Storage methods on both client storage and guild storage like
getItem()
andsetItem()
have been changed toget()
andset()
. 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 baseGuildStorage
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
- Guild storage access has changed from
- All client/guild storage/settings methods are now asynchronous, supporting
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
toCommand#respond
and exposed as protected method (5470a51, ea6975e) - Renamed
CommandInfo/Command#permissions
toCommandInfo/Command#callerPermissions
(1f3c3fe) - Renamed
CommandInfo/Command#description
andextraHelp
todesc
andinfo
respectively (721d8ad) - Removed
Client#config
and theconfig
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 useownerOnly
commands
- This adds an
- Removed
Client#name
,Client#version
, and theversion
command (8dbe49e) - Removed the
client
(originallybot
) param from the Command constructor (78820fa)- Classes extending Command must now only pass the CommandInfo object to
super()
- Classes extending Command must now only pass the CommandInfo object to
- Removed
CommandRegistry#filterDMHelp()
,filterDMUsable()
, andfilterGuildUsable()
(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
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 toLogLevel.DEBUG
but can be set lower or toLogLevel.NONE
if desired to turn off logging. You will need to importLogLevel
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 andlocalizable
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
- Comes with
- Add Plugin support (eb25cb2)
- Allows an easy way to provide custom commands/languages/functionality
for any YAMDBF Client
- Allows an easy way to provide custom commands/languages/functionality
- 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)