Releases: yamdbf/core
Releases · yamdbf/core
v3.0.0
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)
Fixes
v2.6.2
v2.6.1
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
andYamdbf
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
v2.6.0
Updates
- Add
limit
andclearlimit
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 textmod
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 rolesclearlimit
does what the name suggests. It will clear all roles from the limiter for the command
- This will likely replace the
- 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
- Switch to
Command#roles
may be removed in the future in favor of the newlimit
command functionality. Still undecided on this
Bug fixes
- Fix for non-space command arg separators