generated from nhcarrigan/template
Reviewed-on: https://codeberg.org/nhcarrigan/tingle-bot/pulls/1 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
29 lines
842 B
TypeScript
29 lines
842 B
TypeScript
/**
|
|
* @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<AttachmentData> => {
|
|
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"),
|
|
};
|
|
};
|