UNPKG

@lskjs/bots-plugin-notify

Version:

LSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creation

33 lines (29 loc) 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMd = createMd; exports["default"] = void 0; var stringify = function stringify(data, bot) { return bot.formatCode(JSON.stringify(data, null, 2)); }; function createMd() { var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var bot = arguments.length > 1 ? arguments[1] : undefined; var title = message.title, projectName = message.projectName, url = message.url, level = message.level; var _message$data = message.data, data = _message$data === void 0 ? '' : _message$data; var sign = '❗️'; if (level === 'warn') sign = '⚠️'; if (typeof data !== 'string') data = stringify(data, bot); var formatProjectName = bot.ignoreMd(projectName); var formatTitle = bot.ignoreMd(title); var formatUrl = bot.ignoreMd(url); return "".concat(sign, " ").concat(formatProjectName, "\n").concat(formatTitle, "\n").concat(data || '', "\n").concat(formatUrl); } var _default = createMd; exports["default"] = _default; //# sourceMappingURL=createMd.js.map