v2.1.0
Note: This version of Yuuko is still built against [email protected]
, not the latest version. This may cause issues for Typescript users on [email protected]
.
Additions
-
New
EventListener
class which you can use to encapsulate plain event listeners, similar to theCommand
class. This is designed to let you split your bot's logic across multiple files for more than just commands. You can use a ready listener with{once: true}
to execute whatever code you want exactly once when the bot starts up. These listeners get access to the same context args as commands.const {EventListener} = require('yuuko'); module.exports = new EventListener('messageCreate', (message, context) => { // Process the message, with access to `context.client` and your own context additions }, { once: false // set to true to register this listener with `.once` rather than `.on` - particularly useful with the ready event });
-
To go along with the new event handlers, the methods for registering files and directories with your client have changed -
addCommandFile
is nowaddFile
, andaddCommandDir
is nowaddDir
. The old "command" names are still around as aliases, but are deprecated, and will also load any event listener files you have in the target directories. In a future version, the old names will be removed. You should update existing code to use the new names now.
Deprecations
Client#addCommandFile
andClient#addCommandDir
as noted above - move toClient#addFile
andClient#addDir
respectively.
Fixes
- Bumped some dependencies to fix security issues