Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected async doSend(msg: any,
destinations: Destination | Destination[],
options?: MessageOptions) {
let s = "";
if (isSlackMessage(msg)) {
s += `@atomist: ${render(msg, true)}`;
} else {
s += `@atomist: ${msg}`;
}
logger.info(s);
}
}
event: isEventIncoming(this.request) ? this.request.extensions.operationName : undefined,
destinations: responseDestinations,
id: options.id ? options.id : undefined,
timestamp: ts,
ttl: ts && options.ttl ? options.ttl : undefined,
post_mode: options.post === "update_only" ? "update_only" : (options.post === "always" ? "always" : "ttl"),
};
if (destinationIdentifier === "web") {
return Promise.resolve();
} else if (destinationIdentifier === "slack") {
if (isSlackMessage(msg)) {
const msgClone = _.cloneDeep(msg);
const actions = mapActions(msgClone);
response.content_type = MessageMimeTypes.SLACK_JSON;
response.body = render(msgClone, false);
response.actions = actions;
} else if (isFileMessage(msg)) {
response.content_type = MessageMimeTypes.SLACK_FILE_JSON;
response.body = JSON.stringify({
content: msg.content,
filename: msg.fileName,
filetype: msg.fileType,
title: msg.title,
initial_comment: msg.comment,
});
} else if (typeof msg === "string") {
response.content_type = MessageMimeTypes.PLAIN_TEXT;
response.body = msg;
} else if (!!options.delete) {
response.content_type = "application/x-atomist-delete";
response.body === undefined;