mardi 4 août 2020

Botium - How can I get the bot response and send it to a custom asserter?

I'm trying to handle the bot response in a custom asserter is there a way to implement something like this?

#me
Hi

#bot
CUSTOMASSERT $response

And use the response in the CUSTOMASSERT

  module.exports = class CustomAssert {
    constructor (context, caps, globalArgs) {
    this.context = context
    this.caps = caps
    this.globalArgs = globalArgs
    console.log(`MyCustomAsserter constructor, globalArgs: ${utils.inspect(globalArgs)}`)
  }

  assertConvoStep ({ convo, convoStep, args, botMsg }) {
    
    console.log(`MyCustomAsserter assertConvoStep ${convo.header.name}/${convoStep.stepTag}, args: ${utils.inspect(args)}, botMessage: ${botMsg.messageText}`)
    return Promise.resolve()
  }

  assertConvoEnd ({ convo, transcript, args, isGlobal }) {
    console.log(`MyCustomAsserter assertConvoEnd ${convo.header.name}, conversation length: ${transcript.steps.length} steps`)
    return Promise.resolve()
  }

Aucun commentaire:

Enregistrer un commentaire