
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
slackbotify
Advanced tools
Simple slackbot framework
npm install slackbotify
Creating a slackbot is as easy require the dependency, load the config and register a handler. Run it. Done. Slackbot is ready!
const Bot = require('slackbotify');
let bot = new Bot({
"bot": {
"token": "xoxb-XXXXX-XXXXX",
"name": "butler"
}
});
bot.registerHandler({
groups: ['direct'],
match: /hi/ig,
handler: function (message, callback) {
callback('Hi there! :smiley:');
}
});
bot.registerHandler({
groups: ['channel', 'direct'],
match: /:smile:/ig,
handler: function (message, callback) {
callback(':slightly_smiling_face:');
}
});
bot.run();
The only thing you have to pass to the constructor is a config object, and this config object should have at least a bot
object with 2 properties: token
& name
. (example above)
To register a handler to the bot simple pass an object to the registerHandler
function. This object needs to contain the following properties: group
, match
, handler
.
The group defines where the command is available. There are 3 groups. channel
, direct
, admin
. Handlers which are registered to the 'channel' group will fire when a message is send in a channel where the bot is invited to. 'Direct' handlers are private messages to the bot, and the 'admin' group handlers can only be called by an admin user in a private message.
A handler can be registered to multiple groups. In the example above the first handler is listening to direct messages only. The second handler will be called when a :smile: is send in a private message or in a channel where the bot is in.
The 'match' property is what the message should match in order to get called. This can be a regex or a string.
The handler is a function which receives as the first argument the slack message object. The result of the matched message is located at message.matchResult
this is the parsed result by the .match()
function. The second argument is the callback. The response you give to that callback is send to the user, so basically what the bot will answer.
The current bots are using slackbotify
FAQs
Simple slackbot framework
The npm package slackbotify receives a total of 2 weekly downloads. As such, slackbotify popularity was classified as not popular.
We found that slackbotify 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.