1.0.10-alpha.23 • Published 2 years ago
ori-bot-runtime v1.0.10-alpha.23
bot-runtime
TODO: description
How to setup a bot?
//Pull the configuration, which can reside anywhere like db storage, or flat file.
const workflows_docs = await WorkflowViewModel.find({ active: true }).exec()
//convert the configuration to dialog
const workflow_dialogs = workflows_docs.map(workflow => new WorkflowDialog(workflow.wid, workflow.scripts()))
// Define a storage adapter
const memoryStorage = new MongoStorage({
uri: `${process.env.MONGO_URI}`
})
const mainDialog = new OnIntentDialog('default', workflow_dialogs[0])
const bot = new OriBot(mainDialog, memoryStorage)
//Define an channel adapter
const botAdapter = new WebSocketAdapter()
//Define socket handlers
socket.on('new_message', (data, callback) => {
botAdapter.processSocketEvent(socket, 'new_message', data, (context) => bot.run(context))
callback(false)
})
socket.on('buttonSelection', (data, callback) => {
botAdapter.processSocketEvent(socket, 'buttonSelection', data, (context) => bot.run(context))
callback(false)
})
1.0.10-alpha.23
2 years ago
1.0.10-alpha.21
2 years ago
1.0.10-alpha.20
2 years ago
1.0.10-alpha.19
2 years ago
1.0.10-alpha.9
2 years ago
1.0.10-alpha.7
2 years ago
1.0.10-alpha.8
2 years ago
1.0.10-alpha.5
2 years ago
1.0.10-alpha.6
2 years ago
1.0.10-alpha.4
2 years ago
1.0.10-alpha.18
2 years ago
1.0.10-alpha.16
2 years ago
1.0.10-alpha.17
2 years ago
1.0.10-alpha.14
2 years ago
1.0.10-alpha.15
2 years ago
1.0.10-alpha.12
2 years ago
1.0.10-alpha.13
2 years ago
1.0.10-alpha.10
2 years ago
1.0.10-alpha.11
2 years ago
1.0.10-alpha.1
2 years ago
1.0.10-alpha.2
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.10-alpha.3
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago