feat: update this highly outdated app to use latest packages and custom configs (#1)

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>
This commit is contained in:
2024-09-26 19:46:33 +00:00
committed by Naomi the Technomancer
parent 1339b63378
commit 7c0bd7ad10
74 changed files with 6348 additions and 8905 deletions

View File

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