3.1.8 • Published 14 days ago

@oriserve01/bot-runtime v3.1.8

Weekly downloads
-
License
ISC
Repository
-
Last release
14 days ago

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)
})
3.1.8

14 days ago

3.1.7

1 month ago

3.1.6

1 month ago

3.1.3

2 months ago

3.1.2

2 months ago

3.1.4

2 months ago

3.0.31

2 months ago

3.0.30

2 months ago

3.0.29

2 months ago

3.0.28

2 months ago

3.0.23

3 months ago

3.0.24

3 months ago

3.0.21

3 months ago

3.0.22

3 months ago

3.0.27

3 months ago

3.0.25

3 months ago

3.0.26

3 months ago

3.0.20

3 months ago

3.0.18

3 months ago

3.0.19

3 months ago

3.0.9

4 months ago

3.0.12

4 months ago

3.0.4

5 months ago

3.0.13

4 months ago

3.0.3

5 months ago

3.0.10

4 months ago

3.0.2

5 months ago

3.0.11

4 months ago

3.0.1

5 months ago

3.0.16

3 months ago

3.0.8

4 months ago

3.0.17

3 months ago

3.0.7

5 months ago

3.0.14

4 months ago

3.0.6

5 months ago

3.0.15

3 months ago

3.0.5

5 months ago

3.0.0

6 months ago

2.1.0

6 months ago