Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

Something went wrong: event.reply is not a function #5

Open
lesyk opened this issue Jul 23, 2017 · 2 comments
Open

Something went wrong: event.reply is not a function #5

lesyk opened this issue Jul 23, 2017 · 2 comments
Assignees
Labels

Comments

@lesyk
Copy link
Contributor

lesyk commented Jul 23, 2017

In nutshell, reply function is not part of event variable.
If you run botpress as standalone solution, reply will exist as a function, but if you run it through broad setup, reply will not be in a list of functions.

brood-kit-botpress index.ts:

...
const bot = new Bot({
  logLevel: "info"
});

bot.use(slack);
const path = require("path");
const BroidKitBotpress = require("@broid/kit-botpress");
bot.use(new BroidKitBotpress({
  botpressPath: path.join(__dirname, 'botpress')
}));
const app = express();
app.use("/", bot.getRouter());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.listen(8080);
bot.hear(".*", "Person").subscribe({
    next: (data) => {
      console.log(`Received message: ${data}`);
...

botpress index.js:

module.exports = function(bp) {

  // Listens for a first message (this is a Regex)
  // GET_STARTED is the first message you get on Facebook Messenger
  bp.hear(/GET_STARTED|hello|hi|test|hey|holla/i, (event, next, x) => {
    console.log("event:",event);
    console.log("next:",next);
    console.log("bp:",bp);
    event.reply('#welcome') // See the file `content.yml` to see the block
  })

  // You can also pass a matcher object to better filter events
  bp.hear({
    type: /message|text/i,
    text: /exit|bye|goodbye|quit|done|leave|stop/i
  }, (event, next) => {
    event.reply('#goodbye', {
      // You can pass data to the UMM bloc!
      reason: 'unknown'
    })
  })
}
@lesyk
Copy link
Contributor Author

lesyk commented Jul 24, 2017

Comment from botpress:

it is highly probably that they haven't aded support for UMM (event.reply)...

@killix
Copy link
Collaborator

killix commented Jul 29, 2017

still investigating...

@killix killix mentioned this issue Jul 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants