
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.
bot-worker-engine
Advanced tools
A simple bot engine dispatching workers. (mostly and deliberately without OOP)
npm install bot-worker-engine
Here is a simple counting echo bot as example. This might be inside the function which received a web hook call and normalized the input data from one messaging event
const {orchestrate} = require('bot-worker-engine')
const {send, userDate} = require('<platform-dependent-connector>')
const persistence = require('<persistence-layer')
// these are where your code goes
const helpers = require('./helpers') // any helper functions you might need
// example worker just
const workers = {
main: (dispatcher, store, bot, helpers) => {
const {text, session} = store.getState().input
bot.send.text(`Echo (${session.count}): ${text}`)
store.dispatch({type: 'INCREMENT_COUNT'})
dispatcher.emit('finished')
}
}
const reducer = (action, state) => {
switch(action.type) {
case 'INCREMENT_COUNT':
const session = state.session
session.count++
return Object.assign({}, state, {session})
default:
return state
}
} // Redux reducer function
const sessionDefaults = {count: 1} // defaults for empty sessions
// this starts the whole process of the normalized input
orchestrate({input, sessionDefaults, workers, reducer, persistence, send, userData, helpers})
FAQs
Simple bot engine
We found that bot-worker-engine 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.