![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Gu is a minimalistic bot makers wrapper for the irc module.
It adds two key features to the irc module module:
Create a main file, bot.js
say:
var gu = require('gu')(server, "botName", ircOpts, scriptPath, files);
The first three arguments to Gu
are simply passed through to the irc module. The fourth and fifth is the script path, and the files in the scriptpath that will be watched for changes (and is assumed to contain handlers exported behind a function).
Then, put a file in your scriptpath, like.js
, say, and add handlers therein:
module.exports = function (gu) {
gu.on(/^i like your (\w*)$/, function (what) {
gu.say('i has ' + what + ' :O');
});
};
Then fire up the bot with node bot.js
, navigate to the specified server and channel (in ircOpts
),
and try saying botName: i like your charisma
in the channel.
Changing the handler in like.js
will result in different behaviour without having to restart bot.js
.
A more extensive example is avaiable in the example directory.
The following personal bots are all built on gu
:
Since gu
handlers are essentially transportless response functions, if your handler packages does not include the gu
dependency, you can essentially release the behaviour, and let people include it using the gu transport they want. XMPP should be a easy to implement as a drop in replacement for gu (TODO).
The script path you specify to gu
should only contain the handler functions. If you point the path at your lib
dir, then it may reload all the files in that directory when you change one of your handlers.
$ npm install gu --save
Install development dependencies
$ npm install
Run the tests
$ npm test
MIT-Licensed. See LICENSE file for details.
FAQs
Streaming bot makers library with regex handlers
The npm package gu receives a total of 11 weekly downloads. As such, gu popularity was classified as not popular.
We found that gu demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.