Closed KeesCBakker closed 1 year ago
Yes, there was an API change between 7 and v9. Specifically, the move to async/await style code. The code above would look like the following for v9:
robot.receiveMiddleware(async context => {
var text = context.response.message.text;
var newText = mapping.process(text);
if (text != newText) {
context.response.message.text = newText;
if (robot.logger) {
robot.logger.info(`Routing '${text}' to '${newText}'.`);
}
}
return true;
});
Returning true
will tell the code to continue the pipeline. Returning false
will halt the pipeline. Looking at robot.receive, you'll see the infrastructure that does this.
Please let me know how you move forward. I haven't seen much feedback after resuscitating Hubot's development and am super curious to hear, collaborate and see the community that's still using Hubot.
Awesome! Let me upgrade some code. Looks like we also need to update hubot-mock-adapter
.
Fortunately the upgrade was not very hard: https://github.com/KeesCBakker/hubot-command-mapper/commit/2504fd5fa1fbe5c27b04044e0fdceb1a514e8e51
@KeesCBakker I'm really glad to hear that. I've been making some big moves in the codebase with very little feedback to guide decisions.
What are your thoughts about closing this issue?
Yeah, we can close it. Should I open a new ticket for the mock adapter peer dependency?
@KeesCBakker yes please. That way it stands out as I continue to monitor issues from the main repo page.
The code I'm using from the bot is: