hubot-command-mapper
Version:
Helps with mapping tools and commands to Hubot.
16 lines (15 loc) • 482 B
JavaScript
import removeMarkDown from "remove-markdown";
export function removeMarkdownFromIncomingMessages(robot) {
if (!robot)
throw "Argument 'robot' is empty.";
robot.receiveMiddleware(async (context) => {
const text = context.response.message.text;
if (text) {
let newText = removeMarkDown(text);
if (text != newText) {
context.response.message.text = newText;
}
}
return true;
});
}