Files
shockbot/utils/buildShockbotFooter.ts

18 lines
672 B
TypeScript

const FOOTER_MARKER = "<!-- shockbot-footer -->";
export function buildShockbotFooter(params?: {
model?: string | undefined;
}): string {
const modelPart = params?.model ? ` · \`${params.model}\`` : "";
return `\n\n<br>\n\n---\n${FOOTER_MARKER}\n*Reviewed by [shockbot](https://git.shockvpn.com/shockbot)${modelPart}*`;
}
export function stripExistingFooter(body: string): string {
const markerIdx = body.lastIndexOf(FOOTER_MARKER);
if (markerIdx === -1) return body;
// walk back past "\n\n---\n" before the marker
const beforeMarker = body.slice(0, markerIdx);
const stripped = beforeMarker.replace(/\s*\n+---\n$/, "").trimEnd();
return stripped;
}