This repository has been archived on 2025-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tingle-bot/src/modules/images/getBannerImage.ts
2024-09-26 11:37:00 -07:00

20 lines
673 B
TypeScript

import { join } from "path";
import { AttachmentData } from "../../interfaces/commands/AttachmentData";
import { RegionName } from "../../interfaces/weather/names/RegionName";
/**
* Selects one of the random banner images from the banner folder.
*
* @param {RegionName} region The name of the region.
* @returns {AttachmentData} The banner image attachment data.
*/
export const getBannerImage = (region: RegionName): AttachmentData => {
const fileName = `${region}${Math.ceil(Math.random() * 3)}.png`;
const filePath = join(process.cwd(), "src", "assets", "banners", fileName);
return {
attachmentString: `attachment://${fileName}`,
filePath,
};
};