@intuitionrobotics/bug-report
Version:
28 lines • 1.37 kB
JavaScript
import { generateHex, ImplementationMissingException, Module } from "@intuitionrobotics/ts-common";
import { Platform_Slack } from "../../index.js";
import {} from "./BugReportModule.js";
import { SlackModule } from "@intuitionrobotics/thunderstorm/app-backend/modules/SlackModule";
export class SlackBugReportIntegrator_Class extends Module {
constructor() {
super("SlackBugReportIntegrator");
}
openTicket = async (bugReport, logs, reporter) => {
if (bugReport.platforms && !bugReport.platforms.includes(Platform_Slack))
return;
if (!this.config.channel)
throw new ImplementationMissingException("Missing Slack Channel in bug report configurations");
let description = logs.reduce((carry, log, i) => {
return carry + "\n" + `<${log.path}|Click to view logs (${i})>`;
}, bugReport.subject + "\n" + bugReport.description);
if (reporter)
description += "\nReported by: " + reporter;
const slackMessage = {
text: description,
channel: this.config.channel
};
await SlackModule.postMessage(slackMessage);
return { platform: Platform_Slack, issueId: generateHex(32) };
};
}
export const SlackBugReportIntegrator = new SlackBugReportIntegrator_Class();
//# sourceMappingURL=SlackBugReportIntegrator.js.map