/** * @copyright nhcarrigan * @license Naomi's Public License * @author Naomi Carrigan */ import { join } from "node:path"; import sharp from "sharp"; import type { AttachmentData } from "../../interfaces/commands/attachmentData.js"; /** * Module to combine an overlay and a banner. * @param banner - The file path for the banner. * @param overlay - The file path for the overlay. * @returns The attachment data for the new banner. */ export const overlayImages = async( banner: string, overlay: string, ): Promise => { await sharp(banner). composite([ { gravity: "center", input: overlay } ]). toFile(join(process.cwd(), "src", "assets", "overlay.png")); return { attachmentString: `attachment://overlay.png`, filePath: join(process.cwd(), "src", "assets", "overlay.png"), }; };